mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
fix #6
This commit is contained in:
1 parent
491ac20974
commit
1074c21c00
3 files changed
+15
-14
No files matched your search
@@ -1,4 +1,5 @@
|
||||
const { EventEmitter } = require('events');
|
||||
const cluster = require('cluster');
|
||||
|
||||
const bus = new EventEmitter();
|
||||
|
||||
@@ -26,7 +27,8 @@ function unsubscribe(events, handler, funcName) {
|
||||
}
|
||||
|
||||
function publish(event, payload, isMaster = true) {
|
||||
if (isMaster && process.send) {
|
||||
// Process forked by pm2 would also have process.send
|
||||
if (isMaster && process.send && !cluster.isMaster) {
|
||||
process.send({
|
||||
event: 'bus',
|
||||
eventName: event,
|
||||
|
||||
Reference in new issue
Block a user