forwardemail / forwardemail/superagent

retry async function not working

Open
#1,648 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
16.6k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.