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

Second request to a DO hangs if installing default Sinon.js fake timer #190

Closed
vlovich opened this issue Feb 27, 2022 · 1 comment
Closed
Milestone

Comments

@vlovich
Copy link
Contributor

vlovich commented Feb 27, 2022

If I install Sinon.JS fake timer as follows:

    fakeClock = FakeTimers.install({
      toFake: ['setImmediate']
    })
    fakeClock.setSystemTime(1643948235000)

the second request to a DO seems to hang. Since setImmediate is by default hijacked when FakeTimers.install is invoked without arguments this is a problem. Spelunking through the code, it seems like setImmediate is used for DO I/O gates which seems like a likely explanation as to why that happens. Maybe using queueMicrotask and capturing the value in the global scope might avoid problems with fake timers?

@mrbbot
Copy link
Contributor

mrbbot commented Mar 4, 2022

Hey! 👋 Yep, that seems like the problem. I wonder if importing setImmediate directly from the timers built-in module gives you a unmocked version? Could use that instead... 🤔

@mrbbot mrbbot added this to the 2.4.0 milestone Mar 8, 2022
@mrbbot mrbbot modified the milestones: 2.4.0, 2.5.0 Apr 2, 2022
@mrbbot mrbbot modified the milestones: 2.5.0, 2.6.0 May 27, 2022
@mrbbot mrbbot modified the milestones: 2.6.0, 2.7.0 Jul 9, 2022
@mrbbot mrbbot modified the milestones: 2.7.0, 2.8.0 Aug 19, 2022
@mrbbot mrbbot modified the milestones: 2.8.0, 2.9.0 Sep 7, 2022
@mrbbot mrbbot closed this as completed in e5fe3bb Sep 12, 2022
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