Uh oh!
There was an error while loading. Please reload this page.
connection: use ~~process.nextTick~~ setImmediate - #166
Conversation
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
ryanseys
commented
Sep 2, 2014
We should be using Pasted here for easy reading:
|
stephenplusplus
commented
Sep 2, 2014
From the link:
We're just executing a callback. I'm inclined to stick to nextTick for convention reasons, as well as it's the model scenario for async-ifying sync methods according to the docs: process.nextTick. |
ryanseys
commented
Sep 2, 2014
We should only use |
stephenplusplus
commented
Sep 2, 2014
My only reasons for nextTick over setImmediate are based purely on the convention and nextTick documentation. I haven't seen a use of setImmediate to async a sync method, and would feel more comfortable if I did. I do see your points, however I don't think they affect us. It would take a very serious misuse of our library to stack a But, yolo. I'll switch it to setImmediate, 'cause why not. It doesn't seem to hurt anything, other than offer a minimal performance loss. Feels weird, but what doesn't in Node? (@rakyll - feel free to chime in if you prefer it to stick to nextTick) |
ryanseys
commented
Sep 2, 2014
Yeah before either of us make a decision, I would like to hear what @rakyll |
rakyll
commented
Sep 2, 2014
With node v11.0, immediate queue will be able to tick between process ticks. I think that is going to solve the performance concern mentioned above. Otherwise, LGTM. See this test: https://github.com/joyent/node/blob/857975d5e7e0d7bf38577db0478d9e5ede79922e/test/simple/test-timers-immediate-queue.js |
ryanseys
commented
Sep 2, 2014
@stephenplusplus You can probably merge this whenever. |
stephenplusplus
commented
Sep 2, 2014
Woo! Thanks for saving us, Ryan. setImmediate for the win! |
connection: use setImmediate to simulate async.
ryanseys
commented
Sep 2, 2014
😄 👍 |
* build: add Kokoro configs for autorelease * build: add Kokoro configs for autorelease * chore: remove CircleCI config
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
gcr.io/repo-automation-bots/owlbot-nodejs:latest@sha256:f93bb861d6f12574437bb9aee426b71eafd63b419669ff0ed029f4b7e7162e3f
This is really just two types of changes in many places:
Use...
...as opposed to anything else.
Use
process.nextTickin two places to simulate an async operation.