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

Heads up about new major version of set-interval-async #447

Closed
ealmansi opened this issue Mar 29, 2021 · 1 comment
Closed

Heads up about new major version of set-interval-async #447

ealmansi opened this issue Mar 29, 2021 · 1 comment

Comments

@ealmansi
Copy link

Hi @filiphsandstrom.

A new version of set-interval-async is available with improvements on error handling and including a bug fix. You may see the changes in more detail in the release notes.

I'm reaching out because I noticed an instance of the following pattern in your project (link), which may lead to undesired results:

const timer = setIntervalAsync(async () => {
  // ...
  if (/* some condition */) {
    await clearIntervalAsync(timer);
  }
}, interval);

The code above generates a chaining promise cycle which never resolves, because:

  • await clearIntervalAsync(timer) will not resolve until the last execution has finished, AND
  • the last execution will not finish until await clearIntervalAsync(timer) has been resolved.

Simply not awaiting clearIntervalAsync may be enough to avoid this issue, but the right solution will depend on your application's requirements. This didn't surface earlier due to the bug in set-interval-async that has now been fixed in the latest major version.

Best,
Emilio

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
@ealmansi and others