Skip to content

Commit

Permalink
fix: retry on href not host (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe committed Nov 12, 2021
1 parent 3f24ea6 commit 54a1994
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,15 +456,15 @@ export class LinkChecker extends EventEmitter {
return false;
}

// check to see if there is already a request to wait for this host
// check to see if there is already a request to wait for this URL:
let currentRetries = 1;
if (opts.retryErrorsCache.has(opts.url.host)) {
if (opts.retryErrorsCache.has(opts.url.href)) {
// use whichever time is higher in the cache
currentRetries = opts.retryErrorsCache.get(opts.url.host)!;
currentRetries = opts.retryErrorsCache.get(opts.url.href)!;
if (currentRetries > maxRetries) return false;
opts.retryErrorsCache.set(opts.url.host, currentRetries + 1);
opts.retryErrorsCache.set(opts.url.href, currentRetries + 1);
} else {
opts.retryErrorsCache.set(opts.url.host, 1);
opts.retryErrorsCache.set(opts.url.href, 1);
}
// Use exponential backoff algorithm to take pressure off upstream service:
const retryAfter =
Expand Down

0 comments on commit 54a1994

Please sign in to comment.