Skip to content

Commit

Permalink
Attempt to fix #613
Browse files Browse the repository at this point in the history
  • Loading branch information
abluchet committed Aug 7, 2014
1 parent 6e624b1 commit 090c032
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions lib/Watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,28 @@ module.exports = {
}
)
.on('all', function(event, path) {
log('File changed, reloading')
require('./God').restartProcessId(pm2_env.pm_id, function(err, list) {
if(err) {
log('Error while restarting', err);
} else {
log('Process restarted');
}
});
var self = this;

log('File changed, reloading');

if(self.restarting === true) {
log('Already restarting skipping');
return;
} else {

self.restarting = true;

require('./God').restartProcessId(pm2_env.pm_id, function(err, list) {
self.restarting = false;

if(err) {
log('Error while restarting', err);
} else {
log('Process restarted');
}
});

}
});


Expand All @@ -78,9 +91,9 @@ module.exports = {
* @return
*/
close: function(id) {
if(this.watchers[id])
if(this.watchers[id]) {
return this.watchers[id].close();
else {
} else {
return false;
}
}
Expand Down

0 comments on commit 090c032

Please sign in to comment.