|
3 | 3 | var cluster = require('cluster'); |
4 | 4 | var EventEmitter = require('events').EventEmitter; |
5 | 5 | var cpuCount = require('os').cpus().length; |
6 | | -const cache = require('microgateway-plugins').memored; |
| 6 | +const cache = require('microgateway-plugins').emgCache; |
7 | 7 | const writeConsoleLog = require('microgateway-core').Logging.writeConsoleLog; |
8 | 8 |
|
9 | 9 | const CONSOLE_LOG_TAG_COMP = 'microgateway reload cluster'; |
@@ -153,8 +153,14 @@ function cullProcesses() { |
153 | 153 | // |
154 | 154 | if ( !(w.isDead()) && w.isConnected() ) { // If the processes is still live .. first disconnect it |
155 | 155 | try { |
156 | | - w.disconnect() // from the IPC |
157 | | - w_info.request_disconnect = true |
| 156 | + if(w_info.request_disconnect) { |
| 157 | + w.disconnect(); // from the IPC |
| 158 | + } |
| 159 | + else { |
| 160 | + w_info.request_disconnect = true; |
| 161 | + w.send({ request_disconnect: true }); |
| 162 | + console.log(`[${w.process.pid}] sending disconnect request signal to worker`); |
| 163 | + } |
158 | 164 | } catch (e) { |
159 | 165 | // might have never connected |
160 | 166 | //writeConsoleLog('log',{component: CONSOLE_LOG_TAG_COMP},e) |
@@ -286,7 +292,7 @@ class ClusterManager extends EventEmitter { |
286 | 292 |
|
287 | 293 | // --initializeCache--------------------------------------- |
288 | 294 | initializeCache() { |
289 | | - //setup memored - a cache shared between worker processes. intro in 2.5.9 |
| 295 | + // setup emgCache (wrapper above memored) - a cache shared between worker processes. intro in 3.2.3 |
290 | 296 | cache.setup({ |
291 | 297 | purgeInterval: PURGE_INTERVAL |
292 | 298 | }); |
|
0 commit comments