Uh oh!
There was an error while loading. Please reload this page.
lib: remove redundant code from timers.js - #3143
Conversation
Trott
commented
Oct 1, 2015
Fishrock123
commented
Oct 1, 2015
Seems to have originated along with the start of timers, ala pre- bc47353, perhaps insert was once used in more than one place. Not sure. LGTM. Can you ensure there is something to test that negative timeouts do not fire? |
thefourtheye
commented
Oct 1, 2015
Can you leave this check and remove the one at the place where it is called? |
Trott
commented
Oct 2, 2015
@Fishrock123 Regarding testing negative timeouts: Since |
Trott
commented
Oct 2, 2015
@thefourtheye Yes, that is a slightly better approach. Thanks for suggesting it. I've made the change and pushed. |
thefourtheye
commented
Oct 2, 2015
LGTM. |
There was a problem hiding this comment.
isn't this line also redundant?
There was a problem hiding this comment.
Yes. In fact, the whole separation of insert() from active() at this point seems redundant. Just pushed an additional commit.
Fishrock123
commented
Oct 2, 2015
Yes, active is public but should not be -- see: #896 (I'll deal with this soon(tm).) I'd add a test anyways since it currently is public, if the others don't already test it. I haven't looked. |
Trott
commented
Oct 2, 2015
@Fishrock123 Per your suggestion, I've added a test for |
Trott
commented
Oct 3, 2015
@Fishrock123 Regarding #896, if (and only if) you want, I'd be happy to take the first step of that off your plate and make those APIs private within the file and replace the existing exposed functions with deprecation warning-wrapped versions and put it in a semver major PR. |
Fishrock123
commented
Oct 5, 2015
@Trott not worthwhile I think. They should be reworked at the same time. I'll look at it once I'm back from vacation. |
Fishrock123
commented
Oct 5, 2015
This LGTM if it works & CI is happy. |
Trott
commented
Oct 5, 2015
There was a problem hiding this comment.
Why not just hasOwnProperty? Also I feel that if we can check the values also it would be better.
There was a problem hiding this comment.
Shouldn't this check _idleStart also?
There was a problem hiding this comment.
Also note that we do now have notDeepStrictEqual :D
There was a problem hiding this comment.
@thefourtheye@Fishrock123 OK, I've improved the tests quite a bit, I think. Looks good to you now?
insert() is only called from one place where there is already a check that msecs is greater than or equal to zero, so do not repeat the check inside insert(). timers.active() is not documented and should not be exposed, but since it is exposed for now, let's test it.
Trott
commented
Oct 6, 2015
Made the tests a fair bit more rigorous with input from @thefourtheye and @Fishrock123. New CI: https://ci.nodejs.org/job/node-test-pull-request/426/ |
There was a problem hiding this comment.
AH, this should be "should". :)
There was a problem hiding this comment.
Fixed the typo. Thanks for the catch.
thefourtheye
commented
Oct 6, 2015
LGTM |
insert() is only called from one place where there is already a check that msecs is greater than or equal to zero, so do not repeat the check inside insert(). timers.active() is not documented and should not be exposed, but since it is exposed for now, let's test it. PR-URL: nodejs#3143 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Trott
commented
Oct 6, 2015
Landed in 070aac4 |
insert() is only called from one place where there is already a check that msecs is greater than or equal to zero, so do not repeat the check inside insert(). timers.active() is not documented and should not be exposed, but since it is exposed for now, let's test it. PR-URL: #3143 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
insert() is only called from one place where there is already a check
that msecs is greater than or equal to zero, so do not repeat the check
inside insert().