Initial TrueGrowth source import
This commit is contained in:
50
scripts/business-workflow-utility-worker.mjs
Normal file
50
scripts/business-workflow-utility-worker.mjs
Normal file
@@ -0,0 +1,50 @@
|
||||
process.parentPort?.on('message', (message) => {
|
||||
const payload = message?.data || message || {};
|
||||
if (payload.type === 'ping') {
|
||||
process.parentPort.postMessage({
|
||||
type: 'pong',
|
||||
worker: 'business-workflow-utility',
|
||||
pid: process.pid,
|
||||
capabilities: [
|
||||
'clip.compose',
|
||||
'subtitle.generate',
|
||||
'ffmpeg.transform',
|
||||
'social.publish',
|
||||
],
|
||||
});
|
||||
return;
|
||||
}
|
||||
process.parentPort.postMessage({
|
||||
type: 'ack',
|
||||
worker: 'business-workflow-utility',
|
||||
pid: process.pid,
|
||||
received: payload,
|
||||
});
|
||||
});
|
||||
|
||||
process.on('message', (payload) => {
|
||||
if (payload?.type === 'ping') {
|
||||
process.send?.({
|
||||
type: 'pong',
|
||||
worker: 'business-workflow-utility',
|
||||
pid: process.pid,
|
||||
capabilities: [
|
||||
'clip.compose',
|
||||
'subtitle.generate',
|
||||
'ffmpeg.transform',
|
||||
'social.publish',
|
||||
],
|
||||
});
|
||||
return;
|
||||
}
|
||||
process.send?.({
|
||||
type: 'ack',
|
||||
worker: 'business-workflow-utility',
|
||||
pid: process.pid,
|
||||
received: payload,
|
||||
});
|
||||
});
|
||||
|
||||
setInterval(() => {
|
||||
// Keep the isolated worker alive while the local runtime is using it.
|
||||
}, 30_000);
|
||||
Reference in New Issue
Block a user