Commit d38e865f authored by Julien Gilli's avatar Julien Gilli
Browse files

timers: fix timeout when added in timer's callback

When a timer is added in another timer's callback, its underlying timer
handle will be started with a timeout that is actually incorrect.

The reason is that  the value that represents the current time is not
updated between the time the original callback is called and the time
the added timer is processed by timers.listOnTimeout. That leads the
logic in timers.listOnTimeout to do an incorrect computation that makes
the added timer fire with a timeout of scheduledTimeout +
timeSpentInCallback.

This change fixes that and make timers scheduled within other timers'
callbacks fire as expected.

Fixes #9333 and #15447.

PR: #17203
PR-URL: https://github.com/joyent/node/pull/17203


Reviewed-By: default avatarFedor Indutny <fedor@indutny.com>
parent e7c84f82
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment