tools,test: provide duration/interval to timers, require it with lint rule by Trott · Pull Request #9472 · nodejs/node
Navigation Menu
- Notifications You must be signed in to change notification settings
- Fork 35.2k
Conversation
labels
Nov 4, 2016
Trott
mentioned this pull request
2 tasks
Trott
changed the title
tools,test,benchmark: provide duration/interval to timers, require it with lint rule
tools,test: provide duration/interval to timers, require it with lint rule
There are several places in the code base where setTimeout() or setInterval() are called with just a callback and no duration/interval. The timers module will use a value of `1` in that situation. I find an unspecified duration or interval confusing. I always spend a moment wondering if it is a mistake. Did the original author simply forget to provide a value? Did they intend to use setImmediate() or even process.nextTick() instead of setTimeout()? And so on. This change provides a duration or interval of `1` to all calls in the codebase where it is missing. `parallel/test-timers.js` still tests the situation where `setTimeout()` and `setInterval()` are called with `undefined` and other non-numeric values for the duration/interval.
This was referenced
Jan 25, 2017This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters