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

Add this timer test #497

Closed
ry opened this issue Aug 9, 2018 · 1 comment · Fixed by #893
Closed

Add this timer test #497

ry opened this issue Aug 9, 2018 · 1 comment · Fixed by #893

Comments

@ry
Copy link
Member

ry commented Aug 9, 2018

const timers = [];
let timeouts = 0;

for (let i = 0; i < 10; i++) {
  timers[i] = setTimeout(onTimeout, 20);
}

function onTimeout() {
  ++timeouts;
  for (let i = 1; i < 10; i++) {
    clearTimeout(timers[i]);
  }
}

assert(timeouts === 1);
@hayd
Copy link
Contributor

hayd commented Aug 10, 2018

At the moment this is non-deterministic. I get timeouts as either 2 or 1 (on a 2 core machine).

@ry ry modified the milestones: v0.1 (first binary release), future Aug 10, 2018
@ry ry changed the title Add this timer test once unit_tests.ts lands Add this timer test Aug 10, 2018
hayd added a commit to hayd/deno that referenced this issue Oct 3, 2018
piscisaureus pushed a commit to hayd/deno that referenced this issue Oct 3, 2018
hardfist pushed a commit to hardfist/deno that referenced this issue Aug 7, 2024
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 a pull request may close this issue.

2 participants