timers: fix refresh did not call active to make the node exit early.#28192
timers: fix refresh did not call active to make the node exit early.#28192zero1five wants to merge 1 commit intonodejs:masterfrom
Conversation
Trott
left a comment
There was a problem hiding this comment.
The test does not fail without this change. Are we not able to reliably reproduce an issue that this change addresses?
|
@Trott The test failed in v13.0.0-pre and master This should be printed twice. edited: I will change about a valid example during the day, I am too tired. AM4.00... |
f1054f5 to
261530e
Compare
It only prints once for me. Perhaps it is platform and/or environment dependent? |
|
@nodejs/timers |
|
I don't really understand what was incorrect before? |
|
Does this change / fix a problem that could be described as "timer.refresh() does not re-activate a timer which has already timed out"? Does it only change that case? |
I'm well sorry about my English, The most accurate description: When refresh calls a timer that has already been called, the current timer cannot be re-marked as an active event in the event loop. If there is no other event activity, node will exit directly.
Can not... I looked at the 10.x code and it seems to be a bit different.
I think yes, |
Add an or option for put refresh back to work. nodejs#26721 one reason it can't be overridden it only works in the callback of the current timer(before `finally`).
261530e to
33ab12e
Compare
|
Ok I think this may also be fixed by #27345, but this might be able to land sooner / be backported more. cc @apapirovski |
|
If #27345 works well with 10.x, I like it better because it's more like a refactoring, and this one is a bit like monkey patch. |
BridgeAR
left a comment
There was a problem hiding this comment.
To make sure that the test fails on older platforms it's probably useful to start a child process and to log something. That way the main process could verify the output and the broken behavior would be observable.
|
Closing, since #27345 landed. Please leave a comment if this is not fixed by that PR! |
Refresh.() does not get a timer active that has already been invoked. Add an or option for put refresh back to work.
#26721 one reason it can't be overridden it only works in the callback of the current timer(before
finally).Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes