Skip to content
This repository was archived by the owner on Nov 26, 2024. It is now read-only.

Commit f0986f8

Browse files
committed
More details on worker process scripts
1 parent 12a5be6 commit f0986f8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ of all it's okay to write blocking code in the workers. It's what they're
101101
there for.
102102

103103
There are some important things to note however:
104+
104105
1. Always include final line in the example worker above. Without it the parent
105106
process won't know that the worker has started successfully. Also ensure that it's
106107
the very last thing to execute upon initialization so that you can confidently
@@ -110,7 +111,8 @@ code has completed.
110111
2. process.on('message'... must be present in order to receive jobs from the parent.
111112
3. process.send(result) must also be present as the final step of your processing
112113
to send back the result and notify the parent process that the worker is ready for
113-
more work.
114+
more work. If this isn't present or never gets called due to an exception etc., your
115+
worker won't be available to receive any more work and will effectively hang.
114116

115117

116118
Controlling the Number of Workers

0 commit comments

Comments
 (0)