Pass the nextTick into scheduleTimeoutImpl instead of recomputing it
Summary: Currently, every timeout scheduling will compute the next tick twice: * when deciding which bucket to use * when actually scheduling next timeout in `scheduleNextTimeout` This means that we may end up using a bigger nextTick in `scheduleNextTimeout` (if we were at a boundary of a tick and/or if there was a context switch). This means that if the timeout value is low and we will put it for `nextTick`, then it will end up waiting 2.5s (while we make one round over all slots). With this change we make sure that the same tick is used. I could consistently reproduce an issue by running 256 threads that just schedule immediate timeouts all the time. Reviewed By: yfeldblum Differential Revision: D13531907 fbshipit-source-id: a152cbed7b89e8426b2c52281b5b6e171e4520ea
Showing
Please register or sign in to comment