Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timers: clarify lib/timer.js comment #11018

Closed
wants to merge 1 commit into from

Conversation

danbev
Copy link
Contributor

@danbev danbev commented Jan 26, 2017

I stumbled a little when reading the following line:
"Timeouts only need to process any timers due to currently timeout"
and want to suggest changing currently -> the current.

The rest of the changes are only formatting to adhere to the 80
characters code style.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

timers

@nodejs-github-bot nodejs-github-bot added dont-land-on-v7.x timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout. labels Jan 26, 2017
@lance
Copy link
Member

lance commented Jan 26, 2017

LGTM

Copy link
Contributor

@Fishrock123 Fishrock123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still hold by the original wording. It is more correct if perhaps not the most obvious.

Maybe the following would be better:

Timeouts only need to process any timers scheduled to timeout by the time the list is being processed,

Copy link
Member

@lance lance left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Fishrock123 that is better, but I find "by the time the list is being processed" to be a little clunky. How about

For the reasons stated above, a timeout only need to process timeouts from the beginning of the timeout list. Any timers after the first one encountered that does not yet need to timeout will also always be due to timeout at a later time.

@cjihrig
Copy link
Contributor

cjihrig commented Jan 26, 2017

How about changing:

Timeouts only need to process any timers due to currently timeout

to:

Timeouts only need to process timers currently due to expire

@Trott
Copy link
Member

Trott commented Jan 26, 2017

Yet another option: Remove the word currently and change timeout to time out.

  • currently doesn't add information. There is no difference in meaning between "due to currently time out" and "due to time out".

  • At the same time as not adding any information, currently seems to be a source of confusion. So that's two reasons to remove it.

  • It gets rid of a split infinitive. Strictly speaking, split infinitives aren't wrong, but they should be used with care. Three reasons to remove currently.

  • As for timeout -> time out: This adds a little clarity because timeout is a noun and time out is a verb. "The timer is going to time out in 5 ms if you set a timeout of 5."

So: Timeouts only need to process any timers due to time out is still a little awkward but is a little bit in the right direction?

EDIT: Actually, @cjihrig's suggestion above is even better, I think.

@danbev
Copy link
Contributor Author

danbev commented Jan 29, 2017

@Fishrock123 @lance Would you guys also be okay with @cjihrig suggestion?

@lance
Copy link
Member

lance commented Jan 30, 2017

Do :thumbs: not count as LGTM? 😉

Yes that works for me.

@danbev
Copy link
Contributor Author

danbev commented Jan 30, 2017

Do :thumbs: not count as LGTM? 😉

Sorry, I missed your thumps up :) Thanks for that!

@Fishrock123
Copy link
Contributor

Fishrock123 commented Jan 30, 2017

For the reasons stated above, a timeout only need to process timeouts from the beginning of the timeout list. Any timers after the first one encountered that does not yet need to timeout will also always be due to timeout at a later time.

That could work.

I'm not seeing much difference in the current PR text than what is currently in master, aside form the user bit.

Keep in mind that timeout refers to when a a timer is in the process of calling a callback if one exists throughout the comments in other places. If we change one, maybe we should change the others?

It may be better to explain what that timeout operation means if we don't already, most other documentation of timers algorithms also refers to it as that if I recall correctly.

@danbev
Copy link
Contributor Author

danbev commented Jan 31, 2017

I'm not seeing much difference in the current PR text than what is currently in master

I realise my mistake here after re-reading it again a few times, and my original suggestion was just wrong. After reading it think the original is clear.

Though, it does seem like others also find the usage of currently could potentially confuse users as it confused me. Perhaps just removing currently as @Trott suggested would also do. That said I could go either way now and keep it like it is in master.

@danbev
Copy link
Contributor Author

danbev commented Feb 8, 2017

Keep in mind that timeout refers to when a a timer is in the process of calling a callback if one exists throughout the comments in other places. If we change one, maybe we should change the others?

@Fishrock123 If we go with @cjihrig suggestion I don't think we'd need to change anything other places.

It may be better to explain what that timeout operation means if we don't already, most other documentation of timers algorithms also refers to it as that if I recall correctly.

This line does sort of explain what a timeout is. Is this enough or should something else be added to the top of the comment section perhaps to make it clearer you think?

@danbev danbev closed this Feb 17, 2017
@danbev danbev reopened this Feb 17, 2017
@danbev danbev force-pushed the timers-comment-clarification branch from 4218f94 to c03c950 Compare February 17, 2017 07:09
Clarifying and using cjihrig suggestion as mentioned here:
nodejs#11018 (comment)
@danbev danbev force-pushed the timers-comment-clarification branch from c03c950 to b36c429 Compare February 21, 2017 06:51
@danbev
Copy link
Contributor Author

danbev commented Mar 8, 2017

@Fishrock123 Sorry but I forgot to tag you on this before. Would you mind taking a look and see if you find the above acceptable?

@danbev
Copy link
Contributor Author

danbev commented Mar 27, 2017

@Fishrock123 Do you have any additional input on this issue?

@jasnell jasnell added the stalled Issues and PRs that are stalled. label Mar 27, 2017
@fhinkel
Copy link
Member

fhinkel commented May 26, 2017

ping @Fishrock123

@BridgeAR
Copy link
Member

Ping @Fishrock123

@BridgeAR BridgeAR removed the stalled Issues and PRs that are stalled. label Sep 12, 2017
@BridgeAR BridgeAR dismissed Fishrock123’s stale review September 12, 2017 19:06

Dimissing your review due to no response over a long time period. Please take another look.

@BridgeAR
Copy link
Member

BridgeAR commented Sep 12, 2017

I will land this in a few days if there is no one objecting anymore.

@BridgeAR
Copy link
Member

Landed in 3c65a83

@BridgeAR BridgeAR closed this Sep 20, 2017
BridgeAR pushed a commit that referenced this pull request Sep 20, 2017
PR-URL: #11018
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Lance Ball <lball@redhat.com>
jasnell pushed a commit that referenced this pull request Sep 20, 2017
PR-URL: #11018
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Lance Ball <lball@redhat.com>
Qard pushed a commit to Qard/ayo that referenced this pull request Sep 21, 2017
PR-URL: nodejs/node#11018
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Lance Ball <lball@redhat.com>
Qard pushed a commit to Qard/ayo that referenced this pull request Sep 21, 2017
PR-URL: nodejs/node#11018
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Lance Ball <lball@redhat.com>
@danbev danbev deleted the timers-comment-clarification branch September 25, 2017 05:58
MylesBorins pushed a commit that referenced this pull request Oct 17, 2017
PR-URL: #11018
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Lance Ball <lball@redhat.com>
@MylesBorins MylesBorins mentioned this pull request Oct 17, 2017
MylesBorins pushed a commit that referenced this pull request Oct 25, 2017
PR-URL: #11018
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Lance Ball <lball@redhat.com>
@MylesBorins MylesBorins mentioned this pull request Nov 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.
Projects
None yet
Development

Successfully merging this pull request may close these issues.