mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
It's possible for user-code to flip an existing timeout to be an interval during its execution, in which case the current code would crash due to start being undefined. Fix this by providing a default start value within rearm. PR-URL: https://github.com/nodejs/node/pull/18579 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
13 lines
320 B
JavaScript
13 lines
320 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
|
|
// This isn't officially supported but nonetheless is something that is
|
|
// currently possible and as such it shouldn't cause the process to crash
|
|
|
|
const t = setTimeout(common.mustCall(() => {
|
|
if (t._repeat) {
|
|
clearInterval(t);
|
|
}
|
|
t._repeat = true;
|
|
}, 2), 1);
|