注释超时限制
This commit is contained in:
parent
39d5da62fc
commit
cc9e86b8a4
@ -14,7 +14,7 @@ from flask_app.ConnectionLimiter import require_connection_limit
|
||||
upload_bp = Blueprint('upload', __name__)
|
||||
@upload_bp.route('/upload', methods=['POST'])
|
||||
@validate_and_setup_logger
|
||||
@require_connection_limit(timeout=720)
|
||||
# @require_connection_limit(timeout=720)
|
||||
def zbparse(): #大解析
|
||||
logger = g.logger
|
||||
try:
|
||||
|
@ -1,6 +1,8 @@
|
||||
#flask_app/run_serve.py
|
||||
from waitress import serve
|
||||
from flask_app.start_up import create_app
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app=create_app()
|
||||
serve(app, host='0.0.0.0', port=5000)
|
||||
app = create_app()
|
||||
serve(app, host='0.0.0.0', port=5000)
|
||||
|
@ -9,11 +9,15 @@ from flask_app.routes.upload import upload_bp
|
||||
from flask_app.routes.test_zbparse import test_zbparse_bp
|
||||
from flask_app.general.llm.清除file_id import delete_file_by_ids,read_file_ids
|
||||
from flask_app.routes.judge_zbfile import judge_zbfile_bp
|
||||
|
||||
|
||||
class FlaskAppWithLimiter(Flask):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
# 初始化一个字典来存储每个蓝图的限流器
|
||||
self.connection_limiters = {}
|
||||
|
||||
|
||||
def create_app():
|
||||
app = FlaskAppWithLimiter(__name__)
|
||||
# 创建全局日志记录器
|
||||
@ -27,11 +31,11 @@ def create_app():
|
||||
app.connection_limiters['upload'] = ConnectionLimiter(max_connections=10)
|
||||
app.connection_limiters['get_deviation'] = ConnectionLimiter(max_connections=10)
|
||||
app.connection_limiters['default'] = ConnectionLimiter(max_connections=10)
|
||||
app.connection_limiters['judge_zbfile']=ConnectionLimiter(max_connections=30)
|
||||
app.connection_limiters['judge_zbfile'] = ConnectionLimiter(max_connections=30)
|
||||
|
||||
@app.teardown_request
|
||||
def teardown_request(exception):
|
||||
#接口请求之后都会执行该代码,做一些清理工作
|
||||
# 接口请求之后都会执行该代码,做一些清理工作
|
||||
output_folder = getattr(g, 'output_folder', None)
|
||||
if output_folder:
|
||||
# 执行与output_folder相关的清理操作(例如删除临时文件)
|
||||
@ -45,6 +49,7 @@ def create_app():
|
||||
logger.info("清理完毕!")
|
||||
return app
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = create_app()
|
||||
app.run(debug=True, host='0.0.0.0', port=5000)
|
||||
|
Loading…
x
Reference in New Issue
Block a user