mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 16:42:17 +03:00
6b2494a5bc
refs 55060e323c
- This bump was meant to be done when the referenced changes landed. Without it parts of worker thread messages are lost
21 lines
464 B
JavaScript
21 lines
464 B
JavaScript
const {parentPort} = require('bthreads');
|
|
|
|
setInterval(() => { }, 10);
|
|
|
|
if (parentPort) {
|
|
parentPort.on('message', (message) => {
|
|
if (message === 'error') {
|
|
throw new Error('oops');
|
|
}
|
|
|
|
if (message === 'cancel') {
|
|
parentPort.postMessage('cancelled');
|
|
return;
|
|
}
|
|
|
|
// post the message back
|
|
parentPort.postMessage(`Worker received: ${message}`);
|
|
process.exit(0);
|
|
});
|
|
}
|