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

fix(ext/timers): some timers are not resolved #20055

Merged
merged 5 commits into from
Aug 10, 2023

Conversation

bartlomieju
Copy link
Member

@bartlomieju bartlomieju commented Aug 4, 2023

Fixes #19866

@@ -286,7 +287,7 @@ function runAfterTimeout(task, millis, timerInfo) {
while (currentEntry !== null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would using a priority queue be a better idea than looping over a doubly linked list, especially in the cases where the user creates a large number of simultaneously running timers?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@milaz we want to completely overhaul timers implementation so they work nicely with eg. "AsyncLocalStorage". I would prefer to punt on changing the underlying machinery until that happens, but I will definitely take your suggestion into account 👍

@mmastrac
Copy link
Contributor

mmastrac commented Aug 4, 2023

For a test, maybe we can set up a number of timers for ~1ms and call a non-async blocking op for 100ms, forcing them all to resolve at once?

@bartlomieju bartlomieju enabled auto-merge (squash) August 6, 2023 00:16
@bartlomieju bartlomieju changed the title fix: some timers are not resolved fix(ext/timers): some timers are not resolved Aug 6, 2023
@bartlomieju bartlomieju enabled auto-merge (squash) August 10, 2023 03:31
@bartlomieju bartlomieju merged commit 8f85478 into denoland:main Aug 10, 2023
13 checks passed
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

Successfully merging this pull request may close these issues.

😳 setTimeout sometimes (extremely rarely) doesn't fire in Deno versions >= v1.34.3
4 participants