Skip to content

Commit

Permalink
Prepare to release 5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kibertoad committed Dec 14, 2023
1 parent 8bea0b2 commit d7d7fe0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const request: Dispatcher.RequestOptions = {
const retryConfig: RetryConfig = {
maxAttempts: 3,
delayBetweenAttemptsInMsecs: 100,
statusCodesToRetry: [429, 500, 502, 503, 504],
statusCodesToRetry: [429, 500, 502, 503, 504],
respectRetryAfter: true, // if 429 is included in "statusCodesToRetry" and this set to true, delay will be automatically calculated from 'Retry-After' header if present. Default is "true"

// If true, will retry within given limits if request times out
Expand All @@ -37,8 +37,8 @@ const requestParams: RequestParams = {
// if true, response body will be returned as Blob
blobBody: false,

// if set to false, in case of an internal error (e. g. ECONNREFUSED), error will be returned within an Either and not thrown
throwOnInternalError: true,
// if set to true, in case of an internal error (e. g. ECONNREFUSED), error will be thrown and not returned within an Either. Default is false.
throwOnInternalError: false,
}

const result = await sendWithRetry(client, request, retryConfig, requestParams)
Expand Down Expand Up @@ -78,11 +78,11 @@ const response = await sendWithRetry(client, request, {
if (response.statusCode === 502) {
return 60000 - (now % 60000) + OFFSET // this will wait until next minute
}

if (response.statusCode === 503) {
return -1 // Do not retry
}

return undefined // this will fallback to `delayBetweenAttemptsInMsecs` param
},
})
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "undici-retry",
"version": "4.0.0",
"version": "5.0.0",
"license": "MIT",
"description": "Library for handling retry logic with undici HTTP client",
"maintainers": [
Expand Down

0 comments on commit d7d7fe0

Please sign in to comment.