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

retry async function not working #1648

Open
dpanic opened this issue Nov 4, 2021 · 1 comment
Open

retry async function not working #1648

dpanic opened this issue Nov 4, 2021 · 1 comment

Comments

@dpanic
Copy link

dpanic commented Nov 4, 2021

Hi if I implement retry with async callback function. Async sleep will not work.
But if I do it this way:

          .retry(3, (err) => {
            if (err) {
              log.error(err, module, 'Retrying request');

              // sleep sync
              // important: don't remove this, async solution will not work!!!
              Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 2 * 1000);
              return true;
            }

            return false;
          })

All works. Does this look like good solution to you? Apart of it this is blocking worker thread.

@niftylettuce
Copy link
Collaborator

PR welcome to fix this - perhaps start by adding at test that fails?

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

2 participants