Skip to content

Commit

Permalink
check reload logs and avoid cb if error
Browse files Browse the repository at this point in the history
  • Loading branch information
Unitech committed Nov 21, 2014
1 parent 636fd99 commit 197781e
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions lib/God/ActionMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ module.exports = function(God) {
proc.disconnect();
} catch (e) {
// Fallback on disconnect method fail
console.log('Could not disconnect process', e.stack || e);
clearTimeout(timeout);
proc.removeListener('disconnect', onDisconnect);
if (proc && proc.process && proc.process.pid) {
Expand Down Expand Up @@ -491,18 +492,20 @@ module.exports = function(God) {
processIds.forEach(function (id) {
var cluster = God.clusters_db[id];

if (cluster.pm2_env.exec_mode == 'cluster_mode')
cluster.send({type:'log:reload'});
else // Fork mode
console.log('Reloading logs for process id %d', id);

if (cluster.pm2_env.exec_mode == 'cluster_mode') {
cluster.send({
type:'log:reload'
});
}
else if (cluster._reloadLogs) {
cluster._reloadLogs(function(err) {
if (err) {
God.logAndGenerateError(err);
return cb(new Error(err));
};
return false;
if (err) God.logAndGenerateError(err);
});
console.log('Reloading logs for process id %d', id);
}
});

return cb(null, {});
};

Expand Down

0 comments on commit 197781e

Please sign in to comment.