From 072d4d361c39dab53ed7ef547e1dd57b678bd93d Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 8 Sep 2026 11:25:23 -0400 Subject: [PATCH] Limit timeout and retries for open-access PDF lookup This runs during Find Full Text and connector saves, where the default 30-second timeout and hour of 5xx retries are far longer than a user wants to wait. (cherry picked from commit d81484d2e8f1f191d5db2d3cdd0f4f2a428df95e) --- .../zotero/xpcom/utilities_internal.js | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/chrome/content/zotero/xpcom/utilities_internal.js b/chrome/content/zotero/xpcom/utilities_internal.js index 0e13877ffa..ea0800550c 100644 --- a/chrome/content/zotero/xpcom/utilities_internal.js +++ b/chrome/content/zotero/xpcom/utilities_internal.js @@ -1431,7 +1431,7 @@ Zotero.Utilities.Internal = { * * @param {String} doi * @param {Object} [options] - * @param {Number} [options.timeout] - Request timeout in milliseconds + * @param {Number} [options.timeout = 10000] - Request timeout in milliseconds * @return {Object[]} - An array of objects with 'url' and/or 'pageURL' and 'version' * ('submittedVersion', 'acceptedVersion', 'publishedVersion') */ @@ -1446,18 +1446,18 @@ Zotero.Utilities.Internal = { var req = await Zotero.HTTP.request( 'POST', url, - Object.assign( - { - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify({ doi }), - responseType: 'json' + { + headers: { + 'Content-Type': 'application/json' }, - options.timeout && { - timeout: options.timeout - } - ) + body: JSON.stringify({ doi }), + responseType: 'json', + timeout: options.timeout || 10000, + // Keep the wait short, since this runs as part of a + // user-initiated lookup + errorDelayIntervals: [1000, 2000], + errorDelayMax: 5000 + } ); var urls = req.response; Zotero.debug(`Found ${urls.length} open-access PDF `