| ChildProcessWorker.js |
This class wraps the child process and provides a nice interface to
communicate with. It takes care of:
- Re-spawning the process if it dies.
- Queues calls while the worker is busy.
- Re-sends the requests if the worker blew up.
The reason for queueing them here (since childProcess.send also has an
internal queue) is because the worker could be doing asynchronous work, and
this would lead to the child process to read its receiving buffer and start a
second call. By queueing calls here, we don't send the next call to the
children until we receive the result of the previous one.
As soon as a request starts to be processed by a worker, its "processed"
field is changed to "true", so that other workers which might encounter the
same call skip it.
|
8110 |
- |
| messageParent.js |
|
1109 |
- |
| NodeThreadsWorker.js |
|
8230 |
- |
| processChild.js |
This file is a small bootstrapper for workers. It sets up the communication
between the worker and the parent process, interpreting parent messages and
sending results back.
The file loaded will be lazily initialized the first time any of the workers
is called. This is done for optimal performance: if the farm is initialized,
but no call is made to it, child Node processes will be consuming the least
possible amount of memory.
If an invalid message is detected, the child will exit (by throwing) with a
non-zero exit code.
|
3431 |
- |
| threadChild.js |
This file is a small bootstrapper for workers. It sets up the communication
between the worker and the parent process, interpreting parent messages and
sending results back.
The file loaded will be lazily initialized the first time any of the workers
is called. This is done for optimal performance: if the farm is initialized,
but no call is made to it, child Node processes will be consuming the least
possible amount of memory.
If an invalid message is detected, the child will exit (by throwing) with a
non-zero exit code.
|
3732 |
- |