From 1e54070d6d8cd90fdd767a0986e7ef8aa32689ed Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 23 Jun 2026 15:39:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(resm):=20openalex=20PDF=20=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E8=AF=B7=E6=B1=82=E8=A1=A5=20timeout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit save_pdf_from_openalex 的 content.openalex.org 请求此前未设超时, 单次请求挂死会拖过 120s alive 心跳, 触发 ensure_fetch_running 重复点火、 叠加并发链狂打 API。补 timeout=(3,15) 与 elsevier 各处一致, 超时由外层 RequestException 捕获并正常收尾。 Co-Authored-By: Claude Opus 4.8 (1M context) --- apps/resm/tasks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/resm/tasks.py b/apps/resm/tasks.py index 18fc75d..e1e1dc1 100644 --- a/apps/resm/tasks.py +++ b/apps/resm/tasks.py @@ -839,7 +839,8 @@ def save_pdf_from_openalex(paper:Paper): res = requests.get(url=f"https://content.openalex.org/works/{paper.openalex_id}.pdf", params={ "api_key": OPENALEX_KEY - }) + }, + timeout=(3, 15)) except requests.RequestException as e: return f"openalex_pdf_error: {str(e)}" if res.status_code == 200: