fix: 修复爬虫上传端点被限流的问题
- 在爬虫上传的三个端点添加@limiter.exempt装饰器,避免被速率限制 - 在管理端集成页面加载时自动同步文件夹,确保数据一致性
This commit is contained in:
1 parent
af434b8e7f
commit
cdda7fb65d
2 files changed
+6
No files matched your search
@@ -12,6 +12,7 @@ from flask import Blueprint, request, jsonify, current_app
|
||||
from werkzeug.utils import secure_filename
|
||||
|
||||
from ..models import db, UploadLog, User
|
||||
from .. import limiter
|
||||
|
||||
crawler_upload_bp = Blueprint('crawler_uploads', __name__, url_prefix='/api/crawler/uploads')
|
||||
|
||||
@@ -59,6 +60,7 @@ def require_upload_token(f):
|
||||
|
||||
@crawler_upload_bp.route('/init', methods=['POST'])
|
||||
@require_upload_token
|
||||
@limiter.exempt
|
||||
def init_upload():
|
||||
"""
|
||||
初始化上传会话
|
||||
@@ -172,6 +174,7 @@ def init_upload():
|
||||
|
||||
@crawler_upload_bp.route('/<upload_id>/chunk', methods=['POST'])
|
||||
@require_upload_token
|
||||
@limiter.exempt
|
||||
def upload_chunk(upload_id):
|
||||
"""
|
||||
上传文件分片
|
||||
@@ -312,6 +315,7 @@ def upload_chunk(upload_id):
|
||||
|
||||
@crawler_upload_bp.route('/status/<upload_id>', methods=['GET'])
|
||||
@require_upload_token
|
||||
@limiter.exempt
|
||||
def get_upload_status(upload_id):
|
||||
"""
|
||||
获取上传状态
|
||||
|
||||
@@ -423,6 +423,8 @@ const batchDelete = async () => {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// 自动同步文件夹
|
||||
syncFolders()
|
||||
fetchFolders()
|
||||
fetchJobs()
|
||||
fetchResearchers()
|
||||
|
||||
Reference in new issue
Block a user