Skip to content

calculateDelay - retry attempts Β #2375

Open
@suryalokhande

Description

Describe the bug

  • Node.js version: v22.7.0
  • OS & version: MacOs - 14.6.1

Just to set the context....

  1. I have method like...
    async function getErrorCodes() {
    return [
    'ETIMEDOUT',
    'ECONNRESET',
    'EADDRINUSE',
    'ECONNREFUSED',
    'EPIPE',
    'ENOTFOUND',
    'ENETUNREACH',
    'EAI_AGAIN',
    'ERR_SOCKET_TIMEOUT' <-- additionally added for retries...
    ];
    }

  2. i have method like...
    async function exponentialBackOffDelay() {
    return ({ attemptCount,retryOptions,error, computedValue,retryAfter }) => {
    if (computedValue) {
    let cdelay = attemptCount * 5000;
    return cdelay;
    }
    console.log(permitted ${attemptCount} retry attempts have been completed);
    return 0;
    }

async function getGotRequest() {
return got.extend({
retry: {
limit: 5
methods:['GET','PUT'],
errorCodes: await getErrorCodes(),
calculateDelay: await exponentialBackOffDelay()
},
}

We've noticed that even though the limit for all requests is set to 5.
there are some requests that only have 1 retry attempt.

permitted 1 retry attempts have been completed;

and there are some requests that only have 3 retry attempt.

permitted 3 retry attempts have been completed;

and there are some requests that only have 5 retry attempt.

permitted 5 retry attempts have been completed;

My Question
Why are my requests exhibiting varying retry attempts when the limit is set to 5 for all requests?
Could I be overlooking a detail in the exponentialBackOffDelay settings or perhaps in the timeout configurations?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions