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 d81484d2e8)
This commit is contained in:
Dan Stillman 2026-09-08 11:25:23 -04:00
parent a72ffd6549
commit 072d4d361c

View file

@ -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 `