Skip to content

Conversation

@jasnell
Copy link
Member

Checklist
  • documentation is changed or added
  • the commit message follows commit guidelines
Affected core subsystem(s)

doc (timers)

Description of change

General improvements to timers.md copy

@nodejs/documentation

@jasnelljasnell added doc Issues and PRs related to the documentations. timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout. labels May 23, 2016
All of the timer functions are globals. You do not need to `require()`
this module in order to use them.
The `timer` module exposes a global API for scheduling callback functions to
execute at some future period of time. Because the timer functions are globals,
Copy link
Contributor

Choose a reason for hiding this comment

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

execute is "one-off", period would rather indicate a sequence of time, no? Anyhow this sounds a little bulky.

@eljefedelrodeodeljefe
Copy link
Contributor

Generally LGTM. Good work.

Returns the timer.
Returns a reference to the timer object.

[the Node.js Event Loop]: ../topics/the-event-loop-timers-and-nexttick.html
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure this works?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Not yet. Will be double checking the links before landing.
On May 23, 2016 3:57 PM, "Anna Henningsen" [email protected] wrote:

In doc/api/timers.md
#6937 (comment):

+[the Node.js Event Loop]: ../topics/the-event-loop-timers-and-nexttick.html

Are you sure this works?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
https://github.com/nodejs/node/pull/6937/files/a8c72718f4500daa613cfe84416f19e8664f6378#r64303631

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think so

@mscdex
Copy link
Contributor

/cc @Fishrock123


By default, when a timer is scheduled using either `setTimeout()` or
`setInterval()`, the Node.js event loop will continue running as long as the
timer is active. Each of the opaque timer objects returned by these functions
Copy link
Contributor

@Fishrock123Fishrock123May 24, 2016

Choose a reason for hiding this comment

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

"opaque" should be something along the lines of "internally tracked" or something

i.e. no access to a _handle

@Fishrock123
Copy link
Contributor

Should be blocked by #6206 or that should be incorporated, but I'd like to preserve @bengl's contribution if possible.

It should have already landed I think but I haven't gotten around to it.

@jasnell
Copy link
MemberAuthor

@bengl ... looking at #6206, how about we combine efforts into a single PR? I can port your edits on top of mine (keeping it as a separate commit with your name attached).

@bengl
Copy link
Member

@jasnell Yeah sure. You want me to PR against your branch or you got it?

@jasnell
Copy link
MemberAuthor

Either way works!
On May 27, 2016 2:40 PM, "Bryan English" [email protected] wrote:

@jasnellhttps://github.com/jasnell Yeah sure. You want me to PR
against your branch or you got it?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#6937 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAa2eZi4KT-7AqEqhXPOQwPXviks2z5Jks5qF2S6gaJpZM4Ik4sD
.

@benglbengl mentioned this pull request May 27, 2016
@bengl
Copy link
Member

@jasnell alright I made a PR against your branch with roughly the same changes (it was easier to do a completely commit than to rebase).

@jasnell
Copy link
MemberAuthor

Awesome, thank you. Squashed my commits and pulled yours in.
@Fishrock123 ... LGTY?

@jasnell
Copy link
MemberAuthor

@bengl ... made a few additional edits on top .. PTAL

@bengl
Copy link
Member

LGTM

@benjamingr
Copy link
Member

LGTM

Copy link
Contributor

Choose a reason for hiding this comment

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

Has no effect unless the Timeout was previously unrefed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also this does not restore overhead lost by calling unref() -- once you unref it, we'd have to do a linear walk to re-insert it.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Neither of these comments seem to be necessary to add to the user documentation in this PR.

@jasnell
Copy link
MemberAuthor

Updated. PTAL

@jasnell
Copy link
MemberAuthor

If there are no further comments, I will land on Monday

Copy link
Contributor

Choose a reason for hiding this comment

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

Not incorrect, but I think this is still poorly worded.

When called, the Timeout will not keep the event loop open. When Node.js would exit due to inactivity, this timer will longer be considered as activity, and the program may stop before it calls it's callback.

Maybe that would be better? I agree the wording is hard without having a strong idea of the event loop and handle refedness.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I'm not sure that's any better. Rather than hold this up while we get the wording perfect on this, I'd recommend landing and iterating on it separately in subsequent PRs

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm, perhaps, but it should probably at least indicate it has an effect on when the process exits. Perhaps the original wording is the best compromise for now then?

@Fishrock123
Copy link
Contributor

LGTM minus nits (particularly the last one)

@benglbengl mentioned this pull request Jun 6, 2016
2 tasks
@Fishrock123Fishrock123 removed their assignment Jun 15, 2016
@Fishrock123
Copy link
Contributor

ping @jasnell

@jasnell
Copy link
MemberAuthor

Will be back on this after I'm back from vacation
On Jun 15, 2016 1:06 PM, "Jeremiah Senkpiel" [email protected]
wrote:

ping @jasnellhttps://github.com/jasnell


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#6937 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAa2eaKRtSzCcz4qv6BkCJ3KMN9bk3oUks5qMFtCgaJpZM4Ik4sD
.

@jasnell
Copy link
MemberAuthor

Updated one final time to address nit

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this link is incorrect?

@Fishrock123
Copy link
Contributor

LGTM, might want to make sure the link is right though. The other bits can always be addressed in a new PR

@jasnell
Copy link
MemberAuthor

Updated to address the final round of nits

@Fishrock123
Copy link
Contributor

Seems good, let's land and unblock #6956

Overall improvements to timers.md documentation, Includes squashed commit from @bengl: doc: add timer classes The timers returned by `setTimeout` and friends are actually instances of `Timeout` and `Immediate`. Documenting them as such, so that the `ref` and `unref` methods can be identified as methods on `Timeout` objects. Sparked by discussion in nodejs#5792
jasnell added a commit that referenced this pull request Jun 28, 2016
Overall improvements to timers.md documentation, Includes squashed commit from @bengl: doc: add timer classes The timers returned by `setTimeout` and friends are actually instances of `Timeout` and `Immediate`. Documenting them as such, so that the `ref` and `unref` methods can be identified as methods on `Timeout` objects. Sparked by discussion in #5792 PR-URL: #6937 Reviewed-By: Robert Jefe Lindstaedt <[email protected]> Reviewed-By: Bryan English <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
@jasnell
Copy link
MemberAuthor

Landed in 86e07b7

@jasnelljasnell closed this Jun 28, 2016
Fishrock123 pushed a commit that referenced this pull request Jul 5, 2016
Overall improvements to timers.md documentation, Includes squashed commit from @bengl: doc: add timer classes The timers returned by `setTimeout` and friends are actually instances of `Timeout` and `Immediate`. Documenting them as such, so that the `ref` and `unref` methods can be identified as methods on `Timeout` objects. Sparked by discussion in #5792 PR-URL: #6937 Reviewed-By: Robert Jefe Lindstaedt <[email protected]> Reviewed-By: Bryan English <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
@Fishrock123Fishrock123 mentioned this pull request Jul 5, 2016
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docIssues and PRs related to the documentations.timersIssues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@jasnell@eljefedelrodeodeljefe@mscdex@Fishrock123@bengl@benjamingr@addaleax@MylesBorins