mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: cluster.Worker
This commit is contained in:
1 parent
5e8b5d76ad
commit
ead5c3b739
1 file changed
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable no-await-in-loop */
|
/* eslint-disable no-await-in-loop */
|
||||||
import cluster from 'cluster';
|
import cluster, { Worker } from 'cluster';
|
||||||
import serialize from 'serialize-javascript';
|
import serialize from 'serialize-javascript';
|
||||||
import cac from 'cac';
|
import cac from 'cac';
|
||||||
import type {
|
import type {
|
||||||
@@ -195,7 +195,7 @@ export function boardcast<K extends keyof EventMap>(event: K, ...payload: Parame
|
|||||||
} else parallel(event, ...payload);
|
} else parallel(event, ...payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function messageHandler(worker: cluster.Worker, msg: any) {
|
async function messageHandler(worker: Worker, msg: any) {
|
||||||
if (!msg) msg = worker;
|
if (!msg) msg = worker;
|
||||||
// eslint-disable-next-line no-eval
|
// eslint-disable-next-line no-eval
|
||||||
if (typeof msg.payload === 'string') msg.payload = eval(msg.payload);
|
if (typeof msg.payload === 'string') msg.payload = eval(msg.payload);
|
||||||
|
|||||||
Reference in new issue
Block a user