fix: cap rate-limit backoff to daily ebay poll window
This commit is contained in:
parent
e2953a382b
commit
c0914c92b4
1 changed files with 5 additions and 1 deletions
|
|
@ -184,7 +184,11 @@ function isRateLimitError(message: string): boolean {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBackoffMs(consecutiveFailures: number, rateLimited: boolean) {
|
function getBackoffMs(consecutiveFailures: number, rateLimited: boolean) {
|
||||||
const base = rateLimited ? 2 * BASE_REFRESH_MS : BASE_REFRESH_MS / 2
|
if (rateLimited) {
|
||||||
|
return BASE_REFRESH_MS
|
||||||
|
}
|
||||||
|
|
||||||
|
const base = BASE_REFRESH_MS / 2
|
||||||
const multiplier = Math.max(1, consecutiveFailures)
|
const multiplier = Math.max(1, consecutiveFailures)
|
||||||
return Math.min(base * multiplier, MAX_BACKOFF_MS)
|
return Math.min(base * multiplier, MAX_BACKOFF_MS)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue