| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
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? |
Sorry, something went wrong.
|
Can you leave this check and remove the one at the place where it is called? |
Sorry, something went wrong.
|
@Fishrock123 Regarding testing negative timeouts: test/parallel/test-timers.js has a bunch of tests using setTimeout() and setInterval() for various negative numbers. But the very first thing setTimeout() and setInterval() both do is change any value less than 1 to 1. So active() never actually gets the negative number. Does that cover the situation you are concerned about? Or not quite because of the guard code in setTimeout() and setInterval()? Since active() is exported by timers.js, I can try to rig up a test calling it directly. But I dont' think active() should actually be exported. I can't find anything else that uses it, it's not documented, and the argument it requires is awfully specific to timers.js internal working, so I think it should be deprecated and made internal to timers.js. (But uh, that's a much bigger thing than I'd want to tackle with this small PR which I thought was going to be a two-line change...) |
Sorry, something went wrong.
|
@thefourtheye Yes, that is a slightly better approach. Thanks for suggesting it. I've made the change and pushed. |
Sorry, something went wrong.
|
LGTM. |
Sorry, something went wrong.
There was a problem hiding this comment.
isn't this line also redundant?
Sorry, something went wrong.
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.
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
|
@Fishrock123 Per your suggestion, I've added a test for timers.active(). Thanks. |
Sorry, something went wrong.
|
@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. |
Sorry, something went wrong.
|
@Trott not worthwhile I think. They should be reworked at the same time. I'll look at it once I'm back from vacation. |
Sorry, something went wrong.
|
This LGTM if it works & CI is happy. |
Sorry, something went wrong.
Sorry, something went wrong.
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.
Sorry, something went wrong.
There was a problem hiding this comment.
Shouldn't this check _idleStart also?
Sorry, something went wrong.
There was a problem hiding this comment.
Also note that we do now have notDeepStrictEqual :D
Sorry, something went wrong.
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?
Sorry, something went wrong.
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.
|
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/ |
Sorry, something went wrong.
There was a problem hiding this comment.
should, or should not?
Sorry, something went wrong.
There was a problem hiding this comment.
AH, this should be "should". :)
Sorry, something went wrong.
There was a problem hiding this comment.
Fixed the typo. Thanks for the catch.
Sorry, something went wrong.
There was a problem hiding this comment.
Nit: these?
Sorry, something went wrong.
|
LGTM |
Sorry, something went wrong.
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>
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>
| Back | FazBrowse Home | New Git URL |
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().