This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
Repeat unref'd interval persists program until next interval #7327
Closed
Description
Bug: Repeat unref'd interval persists program until next interval
After the ref'd timeout fires, the unref'd interval should not persist the program,
... but it does until the next time the unref'd interval fires.
(should-exit-here) (actually-exits-here)
| |
v v
(time)-------------------------------------------->
^ ^ ^
| | |
300(1st interval) | |
350(timeout) |
600(2nd interval)
// This is an issue for long unref'd intervals such as for garbage-collection.
var assert = require('assert');
var unref_interval = 0;
setInterval(function() {
++unref_interval;
}, 300).unref();
setTimeout(function() {}, 350);
process.on('exit', function() {
assert.strictEqual(unref_interval, 1, "Repeat unref'd interval persists program until next interval");
});