Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calculateDelay - retry attempts #2375

Open
suryalokhande opened this issue Sep 3, 2024 · 0 comments
Open

calculateDelay - retry attempts #2375

suryalokhande opened this issue Sep 3, 2024 · 0 comments

Comments

@suryalokhande
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant