Skip to content

Commit

Permalink
Unitech#2977 reload log try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
Unitech committed Jun 28, 2017
1 parent 57e29c7 commit 65b0c33
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/God/ActionMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -573,14 +573,18 @@ module.exports = function(God) {

console.log('Reloading logs for process id %d', id);

if (cluster &&
cluster.pm2_env) {
if (cluster.send &&
cluster.pm2_env.exec_mode == 'cluster_mode') {
cluster.send({
type:'log:reload'
});
if (cluster && cluster.pm2_env) {
// Cluster mode
if (cluster.send && cluster.pm2_env.exec_mode == 'cluster_mode') {
try {
cluster.send({
type:'log:reload'
});
} catch(e) {
console.error(e.message || e);
}
}
// Fork mode
else if (cluster._reloadLogs) {
cluster._reloadLogs(function(err) {
if (err) God.logAndGenerateError(err);
Expand Down

0 comments on commit 65b0c33

Please sign in to comment.