pwi-plata-type 0.3.12 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/libs/cluster.ts +16 -14
- package/package.json +1 -1
package/libs/cluster.ts
CHANGED
|
@@ -86,7 +86,7 @@ export class PlataClusterManager {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
if (this.Cluster.eventNames().indexOf('message') === -1) {
|
|
89
|
-
this.Cluster.on('message', this._clusterMsgServer)
|
|
89
|
+
this.Cluster.on('message', this._clusterMsgServer(this))
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -179,19 +179,21 @@ export class PlataClusterManager {
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
private
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
182
|
+
private _clusterMsgServer(t: PlataClusterManager) {
|
|
183
|
+
return async (_worker: typeCluster.Worker, msg: PlataClusterMsg) => {
|
|
184
|
+
if (msg.name !== '_plata') {
|
|
185
|
+
// TODO :::
|
|
186
|
+
} else {
|
|
187
|
+
switch(msg.data.action) {
|
|
188
|
+
case 'KILL':
|
|
189
|
+
console.log('Solicitado kill do app')
|
|
190
|
+
process.exit(0)
|
|
191
|
+
;
|
|
192
|
+
case 'ECHO':
|
|
193
|
+
t.sendAllWorkers(msg.data.msg)
|
|
194
|
+
return
|
|
195
|
+
;
|
|
196
|
+
}
|
|
195
197
|
}
|
|
196
198
|
}
|
|
197
199
|
}
|