mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 22:11:09 +03:00
Clarified usecases of 'done' and 'cancelled' job events
no issue - Added docs around which events are suited best for job termination/completeion
This commit is contained in:
parent
6389df346c
commit
238ff4abdb
@ -30,11 +30,17 @@ if (!isMainThread) {
|
||||
await setTimeoutPromise(100); // async cleanup imitation
|
||||
|
||||
if (parentPort) {
|
||||
// preferred method of shutting down the worker
|
||||
// `done' is a preferred method of shutting down the worker
|
||||
// it signals job manager about finished job and the thread
|
||||
// is later terminated through `terminate()` method allowing
|
||||
// for unfinished pipes to flush (e.g. loggers)
|
||||
//
|
||||
// 'cancelled' is an allternative method to signal job was terminated
|
||||
// because of parent initiated reason (e.g.: parent process interuption)
|
||||
// differs from 'done' by producing different
|
||||
// logging - shows the job was cancelle instead of completing
|
||||
parentPort.postMessage('done');
|
||||
// parentPort.postMessage('cancelled');
|
||||
} else {
|
||||
process.exit(0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user