finish proper handling of restart for process group

This commit is contained in:
Stephen Birarda 2015-12-21 12:06:09 -07:00
parent 21c701dc6d
commit 18c8fc8563
3 changed files with 12 additions and 10 deletions

View file

@ -13,6 +13,7 @@ $(function() {
var serverState = arg.home.state;
var serverCircles = $('#ds-status .circle, #ac-status .circle');
switch (serverState) {
case HFProcess.ProcessStates.STOPPED:
serverCircles.attr('class', 'circle stopped');

View file

@ -149,9 +149,7 @@ app.on('ready', function() {
sendProcessUpdate();
});
ipcMain.on('restart-server', function(event, arg) {
homeServer.stop();
sendProcessUpdate();
homeServer.start();
homeServer.restart();
sendProcessUpdate();
});
ipcMain.on('stop-server', function(event, arg) {

View file

@ -59,14 +59,17 @@ ProcessGroup.prototype = extend(ProcessGroup.prototype, {
this.state = ProcessGroupStates.STOPPING;
},
restart: function() {
// set our restart flag so the group will restart once stopped
this.restarting = true;
if (this.state == ProcessGroupStates.STOPPED) {
// start the group, we were already stopped
console.log("STARTING THE GROUP, ALREADY STOPPED");
this.start();
} else {
// set our restart flag so the group will restart once stopped
this.restarting = true;
// call stop, that will put them in the stopping state
this.stop();
// update our state
this.state = ProcessGroupStates.STOPPING;
// call stop, that will put them in the stopping state
this.stop();
}
},
// Event handlers