{"action":"created","issue":{"url":"https://api.github.com/repos/joyent/node/issues/17203","labels_url":"https://api.github.com/repos/joyent/node/issues/17203/labels{/name}","comments_url":"https://api.github.com/repos/joyent/node/issues/17203/comments","events_url":"https://api.github.com/repos/joyent/node/issues/17203/events","html_url":"https://github.com/joyent/node/pull/17203","id":69721560,"number":17203,"title":"timers: fix timeout when added in timer's callback","user":{"login":"misterdjules","id":811047,"avatar_url":"https://avatars.githubusercontent.com/u/811047?v=3","gravatar_id":"","url":"https://api.github.com/users/misterdjules","html_url":"https://github.com/misterdjules","followers_url":"https://api.github.com/users/misterdjules/followers","following_url":"https://api.github.com/users/misterdjules/following{/other_user}","gists_url":"https://api.github.com/users/misterdjules/gists{/gist_id}","starred_url":"https://api.github.com/users/misterdjules/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/misterdjules/subscriptions","organizations_url":"https://api.github.com/users/misterdjules/orgs","repos_url":"https://api.github.com/users/misterdjules/repos","events_url":"https://api.github.com/users/misterdjules/events{/privacy}","received_events_url":"https://api.github.com/users/misterdjules/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/joyent/node/labels/in%20progress","name":"in progress","color":"ededed"},{"url":"https://api.github.com/repos/joyent/node/labels/pr","name":"pr","color":"006b75"},{"url":"https://api.github.com/repos/joyent/node/labels/timer","name":"timer","color":"e10c02"},{"url":"https://api.github.com/repos/joyent/node/labels/v0.10","name":"v0.10","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2015-04-21T02:01:32Z","updated_at":"2015-04-22T18:37:32Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/joyent/node/pulls/17203","html_url":"https://github.com/joyent/node/pull/17203","diff_url":"https://github.com/joyent/node/pull/17203.diff","patch_url":"https://github.com/joyent/node/pull/17203.patch"},"body":"When a timer is added in another timer's callback, its underlying timer\r\nhandle will be started with a timeout that is actually incorrect.\r\n\r\nThe reason is that  the value that represents the current time is not\r\nupdated between the time the original callback is called and the time\r\nthe added timer is processed by timers.listOnTimeout. That leads the\r\nlogic in timers.listOnTimeout to do an incorrect computation that makes\r\nthe added timer fire with a timeout of scheduledTimeout +\r\ntimeSpentInCallback.\r\n\r\nThis change fixes that and make timers scheduled within other timers'\r\ncallbacks fire as expected.\r\n\r\nFixes #9333 and #15447."},"comment":{"url":"https://api.github.com/repos/joyent/node/issues/comments/95295601","html_url":"https://github.com/joyent/node/pull/17203#issuecomment-95295601","issue_url":"https://api.github.com/repos/joyent/node/issues/17203","id":95295601,"user":{"login":"misterdjules","id":811047,"avatar_url":"https://avatars.githubusercontent.com/u/811047?v=3","gravatar_id":"","url":"https://api.github.com/users/misterdjules","html_url":"https://github.com/misterdjules","followers_url":"https://api.github.com/users/misterdjules/followers","following_url":"https://api.github.com/users/misterdjules/following{/other_user}","gists_url":"https://api.github.com/users/misterdjules/gists{/gist_id}","starred_url":"https://api.github.com/users/misterdjules/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/misterdjules/subscriptions","organizations_url":"https://api.github.com/users/misterdjules/orgs","repos_url":"https://api.github.com/users/misterdjules/repos","events_url":"https://api.github.com/users/misterdjules/events{/privacy}","received_events_url":"https://api.github.com/users/misterdjules/received_events","type":"User","site_admin":false},"created_at":"2015-04-22T18:37:32Z","updated_at":"2015-04-22T18:37:32Z","body":"Thank you @indutny @obastemur and @trevnorris for your feedback!\r\n\r\nRan the tests suite and found no regression on [Windows](http://jenkins.nodejs.org/job/node-review-windows-julien/46/) and on [UNIX](http://jenkins.nodejs.org/job/node-review-unix-julien/54/)."}}