mirror of
https://github.com/zotero/zotero.git
synced 2026-10-09 03:18:01 +00:00
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:
parent
a72ffd6549
commit
072d4d361c
1 changed files with 12 additions and 12 deletions
|
|
@ -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 `
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue