Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

timers: fix timeout when added in timer's callback #17203

Closed
wants to merge 1 commit into from

Commits on Jun 17, 2015

  1. 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 nodejs#9333 and nodejs#15447.
    Julien Gilli committed Jun 17, 2015
    Configuration menu
    Copy the full SHA
    fe78c98 View commit details
    Browse the repository at this point in the history