From c5c84964094890c19e82967a74cb3e59d2a266fb Mon Sep 17 00:00:00 2001 From: ericwyuan Date: Thu, 20 Aug 2026 20:43:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=9B=B4=E6=8E=A5=E4=B8=8A=E4=BC=A0mult?= =?UTF-8?q?ipart=E8=B6=85=E6=97=B6=20=E2=80=94=20connect=20timeout=2010s?= =?UTF-8?q?=E2=86=92120s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit requests/urllib3 发送 multipart body 期间 socket timeout 取的是 connect timeout 值而非 read timeout,跨境 1.4MB/s 下 17MB 视频需 ~117s,原 10s 上限导致 100% 超时重试耗尽标记 FAILED。实测 task 50/51 修复后直接上传成功。 --- fam-core/src/fam_core/dispatcher/dispatcher.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fam-core/src/fam_core/dispatcher/dispatcher.py b/fam-core/src/fam_core/dispatcher/dispatcher.py index ff74167..e4802cd 100644 --- a/fam-core/src/fam_core/dispatcher/dispatcher.py +++ b/fam-core/src/fam_core/dispatcher/dispatcher.py @@ -275,7 +275,12 @@ class Dispatcher: self._dispatch_direct(task, payload, upload_path) def _dispatch_direct(self, task, payload, video_path): - """小文件直接上传至 /enqueue""" + """小文件直接上传至 /enqueue + + 注意 timeout 第一参数: urllib3 发送 multipart body 期间 socket + timeout 取的是 connect timeout 值(实测传 60s 则 60s 整超时), + 而非 read timeout——跨境 1.4MB/s 下 17MB 需 ~12s,必须给足。 + """ task_id = task['task_id'] try: with open(video_path, 'rb') as fh: @@ -283,7 +288,7 @@ class Dispatcher: self.edge_url, data=payload, files={'video': (os.path.basename(video_path), fh, 'video/mp4')}, - timeout=(10, 300) + timeout=(120, 300) ) except requests.RequestException as e: logger.error(f"[task_id={task_id}] 上传失败: {e}")