-1

I am using await in code for one of my child processes. So when this is executed, will all others child processes halt their execution or will only this child process will halt?

I am using cluster.fork and await in code is for my child processes.

Denys Séguret
  • 372,613
  • 87
  • 782
  • 758
user3103874
  • 98
  • 1
  • 8

1 Answers1

0

No your await has no impact on other processes.

But you seem to have a misconception: Not only does await not block the other process you got using cluster.fork, but it doesn't either halt your current process.

The code after your await won't be executed until the passed promise is resolved but other promises might be resolved before this one, or other events may be produced by the underlying IO system, even in the same process.

Remember: node was able to handle concurrent requests even before the node cluster system.

Related: Why node.js is fast when it's single threaded?

Denys Séguret
  • 372,613
  • 87
  • 782
  • 758