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: add an internal [@@refresh()] function #18065

Closed

Conversation

Fishrock123
Copy link
Contributor

Hidden via a symbol because I'm unsure exactly what the API should look like in the end.

Removes the need to use _unrefActive() for efficiently refreshing timeouts. It still uses it under the hood but that could be replaced with insert() directly if it were in the same file.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

timers

@Fishrock123 Fishrock123 added timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout. http2 Issues or PRs related to the http2 subsystem. labels Jan 9, 2018
@nodejs-github-bot nodejs-github-bot added the lib / src Issues and PRs related to general changes in the lib or src directory. label Jan 9, 2018
@Fishrock123 Fishrock123 added net Issues and PRs related to the net subsystem. and removed lib / src Issues and PRs related to general changes in the lib or src directory. labels Jan 9, 2018
@@ -908,7 +907,7 @@ class Http2Session extends EventEmitter {
[kUpdateTimer]() {
if (this.destroyed)
return;
if (this[kTimeout]) _unrefActive(this[kTimeout]);
if (this[kTimeout]) this[kTimeout][refresh_fn_symbol](true);
Copy link
Member

Choose a reason for hiding this comment

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

what is the true argument for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whoops, was from a previous API version

@Fishrock123 Fishrock123 force-pushed the timers-internal-refresh branch 4 times, most recently from 11f4c34 to 8c5aa92 Compare January 11, 2018 17:19
@Fishrock123
Copy link
Contributor Author

@apapirovski @zhangzifa Any thoughts?

Copy link
Member

@apapirovski apapirovski left a comment

Choose a reason for hiding this comment

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

I would personally prefer if we went with camel case for the symbols, to match the vast majority of new usage, but the rest of this SGTM. 👍

@Fishrock123
Copy link
Contributor Author

Updated, new CI: https://ci.nodejs.org/job/node-test-pull-request/12755/

@apapirovski better now?

Just cleanup so the file makes more future sense.

PR-URL: nodejs#18065
Reviewed-By: Anatoli Papirovski <[email protected]>
Hidden via a symbol because I'm unsure exactly what the API should look
like in the end.

Removes the need to use _unrefActive for efficiently refreshing
timeouts.
It still uses it under the hood but that could be replaced with
insert() directly if it were in the same file.

PR-URL: nodejs#18065
Reviewed-By: Anatoli Papirovski <[email protected]>
Fishrock123 added a commit that referenced this pull request Jan 26, 2018
Just cleanup so the file makes more future sense.

PR-URL: #18065
Reviewed-By: Anatoli Papirovski <[email protected]>
Fishrock123 added a commit that referenced this pull request Jan 26, 2018
Hidden via a symbol because I'm unsure exactly what the API should look
like in the end.

Removes the need to use _unrefActive for efficiently refreshing
timeouts.
It still uses it under the hood but that could be replaced with
insert() directly if it were in the same file.

PR-URL: #18065
Reviewed-By: Anatoli Papirovski <[email protected]>
@Fishrock123
Copy link
Contributor Author

Thanks, landed in a5a8118...bb5575a

@Fishrock123 Fishrock123 deleted the timers-internal-refresh branch January 26, 2018 21:49
@MylesBorins
Copy link
Contributor

This does not land cleanly on v9.x, should we backport?

MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
Just cleanup so the file makes more future sense.

PR-URL: nodejs#18065
Reviewed-By: Anatoli Papirovski <[email protected]>
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
Hidden via a symbol because I'm unsure exactly what the API should look
like in the end.

Removes the need to use _unrefActive for efficiently refreshing
timeouts.
It still uses it under the hood but that could be replaced with
insert() directly if it were in the same file.

PR-URL: nodejs#18065
Reviewed-By: Anatoli Papirovski <[email protected]>
@codebytere
Copy link
Member

@Fishrock123 should this be backported to v8.x? it doesn't land cleanly as we moved lib/timers.js --> lib/internal/timers.js

@Fishrock123
Copy link
Contributor Author

@codebytere It’d be nice to backport — do you know if it depends on other commits of mine, or only the large timers refactor?

I’ll try to get a backport PR up soon...

@codebytere
Copy link
Member

@Fishrock123 my cursory inspection tells me the two timers commits need to be backported in concert but beyond that i think you're good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http2 Issues or PRs related to the http2 subsystem. net Issues and PRs related to the net subsystem. 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.

6 participants