Skip to content

One mistake in the article of guides #1542

Closed

Description

@evanzlj

Thanks for this article, but when I try to convert this to chinese, I find a error:

Say that listen() is run at the beginning of the event loop, but the listening callback is placed in a setImmediate().

I think the listening callback is placed in the nextTick queue, right?~~

Activity

  1. gibfahn commented on Jan 7, 2018

    @gibfahn
    Member

    Say that listen() is run at the beginning of the event loop, but the listening callback is placed in a setImmediate(). Unless a hostname is passed, binding to the port will happen immediately. For the event loop to proceed, it must hit the poll phase, which means there is a non-zero chance that a connection could have been received allowing the connection event to be fired before the listening event.

    As I understand it, this paragraph is explaining why the listening callback needs to be placed in the nextTick queue, by saying that if it was a setImmediate(), then it would cause problems.

    I think the confusion here is the use of the word Say, I would translate Say as 假如 , as in 假如on('listening')是个setImmediate(),会出......的问题,所以得用process.nextTick().

    Original PR to add this was: nodejs/node#4936 FWIW

  2. added
    i18nIssues/PRs related to the Website Internationalisation
    on Jan 7, 2018
  3. evanzlj commented on Jan 7, 2018

    @evanzlj
    Author

    Got it! Thanks for your help~~^_^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    i18nIssues/PRs related to the Website Internationalisation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions