diff options
author | Brian White <mscdex@mscdex.net> | 2016-10-13 18:02:52 -0400 |
---|---|---|
committer | Evan Lucas <evanlucas@me.com> | 2016-10-14 15:57:25 -0500 |
commit | 42158a03132568ce28cf94e73ba6b8039b208d5d (patch) | |
tree | 8cf20ae2f8112f26ba29c9eed0bc8e55e90bb4fc /test/parallel/test-timers-clearImmediate.js | |
parent | b16a97e042657d4f20c0716c69fb61652c857117 (diff) | |
download | node-new-42158a03132568ce28cf94e73ba6b8039b208d5d.tar.gz |
timers: fix regression with clearImmediate()
This commit fixes a regression introduced in 0ed8839a27 that caused
additional queued immediate callbacks to be ignored if
`clearImmediate(immediate)` was called within the callback for
`immediate`.
PR-URL: https://github.com/nodejs/node/pull/9086
Fixes: https://github.com/nodejs/node/issues/9084
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Diffstat (limited to 'test/parallel/test-timers-clearImmediate.js')
-rw-r--r-- | test/parallel/test-timers-clearImmediate.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/parallel/test-timers-clearImmediate.js b/test/parallel/test-timers-clearImmediate.js new file mode 100644 index 0000000000..ab65b7bf1c --- /dev/null +++ b/test/parallel/test-timers-clearImmediate.js @@ -0,0 +1,18 @@ +'use strict'; +require('../common'); +const assert = require('assert'); + +const N = 3; +var count = 0; +function next() { + const immediate = setImmediate(function() { + clearImmediate(immediate); + ++count; + }); +} +for (var i = 0; i < N; ++i) + next(); + +process.on('exit', () => { + assert.strictEqual(count, N, `Expected ${N} immediate callback executions`); +}); |