mirror of
https://github.com/strapi/strapi.git
synced 2025-09-28 01:40:11 +00:00
Fix PR feedback
This commit is contained in:
parent
72608e953a
commit
217f0193fc
@ -48,7 +48,7 @@
|
|||||||
"plop": "^1.5.0",
|
"plop": "^1.5.0",
|
||||||
"prettier": "^1.5.3",
|
"prettier": "^1.5.3",
|
||||||
"rimraf": "^2.5.4",
|
"rimraf": "^2.5.4",
|
||||||
"strapi-helper-plugin": "file:../strapi-helper-plugin",
|
"strapi-helper-plugin": "3.0.0-alpha.5.5",
|
||||||
"webpack": "^2.1.0-beta.25"
|
"webpack": "^2.1.0-beta.25"
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
|
@ -74,21 +74,22 @@ module.exports = function() {
|
|||||||
|
|
||||||
if (cluster.isMaster) {
|
if (cluster.isMaster) {
|
||||||
cluster.on('message', (worker, message) => {
|
cluster.on('message', (worker, message) => {
|
||||||
if (message !== 'reload') return;
|
switch (message) {
|
||||||
|
case 'reload':
|
||||||
|
strapi.log.info('The server is restarting\n');
|
||||||
|
|
||||||
strapi.log.info('The server is restarting\n');
|
_.forEach(cluster.workers, worker => worker.kill());
|
||||||
|
|
||||||
_.forEach(cluster.workers, worker => worker.kill());
|
cluster.fork();
|
||||||
|
break;
|
||||||
|
case 'stop':
|
||||||
|
_.forEach(cluster.workers, worker => worker.kill());
|
||||||
|
|
||||||
cluster.fork();
|
process.exit(0);ter.fork();
|
||||||
});
|
break;
|
||||||
|
default:
|
||||||
cluster.on('message', (worker, message) => {
|
return;
|
||||||
if (message !== 'stop') return;
|
}
|
||||||
|
|
||||||
_.forEach(cluster.workers, worker => worker.kill());
|
|
||||||
|
|
||||||
process.exit(0);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
cluster.fork();
|
cluster.fork();
|
||||||
|
@ -6,7 +6,7 @@ const utils = require('./utils');
|
|||||||
const http = require('http');
|
const http = require('http');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const cluster = require('cluster');
|
const cluster = require('cluster');
|
||||||
const { includes } = require('lodash');
|
const { includes, get } = require('lodash');
|
||||||
const { logger } = require('strapi-utils');
|
const { logger } = require('strapi-utils');
|
||||||
const { nestedConfigurations, appConfigurations, apis, middlewares, hooks } = require('./core');
|
const { nestedConfigurations, appConfigurations, apis, middlewares, hooks } = require('./core');
|
||||||
const initializeMiddlewares = require('./middlewares');
|
const initializeMiddlewares = require('./middlewares');
|
||||||
@ -138,7 +138,7 @@ class Strapi extends EventEmitter {
|
|||||||
// Destroy server and available connections.
|
// Destroy server and available connections.
|
||||||
this.server.destroy();
|
this.server.destroy();
|
||||||
|
|
||||||
if (cluster.isWorker && process.env.NODE_ENV === 'development' && this.config.currentEnvironment.server.autoReload === true) process.send('stop');
|
if (cluster.isWorker && process.env.NODE_ENV === 'development' && get(this.config, 'currentEnvironment.server.autoReload') === true) process.send('stop');
|
||||||
|
|
||||||
// Kill process.
|
// Kill process.
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
@ -173,7 +173,7 @@ class Strapi extends EventEmitter {
|
|||||||
|
|
||||||
reload() {
|
reload() {
|
||||||
const reload = function() {
|
const reload = function() {
|
||||||
if (cluster.isWorker && process.env.NODE_ENV === 'development' && this.config.currentEnvironment.server.autoReload === true) process.send('reload');
|
if (cluster.isWorker && process.env.NODE_ENV === 'development' && get(this.config, 'currentEnvironment.server.autoReload') === true) process.send('reload');
|
||||||
};
|
};
|
||||||
|
|
||||||
reload.isReloading = false;
|
reload.isReloading = false;
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
module.exports = function reload() {
|
module.exports = function reload() {
|
||||||
try {
|
try {
|
||||||
const reload = function() {
|
const reload = function() {
|
||||||
if (cluster.isWorker && process.env.NODE_ENV === 'development' && this.config.environments[this.config.environment].server.reload === true) process.send('reload');
|
if (cluster.isWorker && process.env.NODE_ENV === 'development' && get(this.config, 'currentEnvironment.server.autoReload') === true) process.send('reload');
|
||||||
};
|
};
|
||||||
|
|
||||||
reload.isReloading = false;
|
reload.isReloading = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user