diff --git a/pkg/instance/process.go b/pkg/instance/process.go index 3429e61..94e057f 100644 --- a/pkg/instance/process.go +++ b/pkg/instance/process.go @@ -350,6 +350,10 @@ func (p *process) handleAutoRestart(err error) { maxRestarts := *opts.MaxRestarts p.restarts++ + + // Set status to Restarting instead of leaving as Stopped + p.instance.SetStatus(Restarting) + log.Printf("Auto-restarting instance %s (attempt %d/%d) in %v", p.instance.Name, p.restarts, maxRestarts, time.Duration(restartDelay)*time.Second) diff --git a/pkg/instance/status.go b/pkg/instance/status.go index 92e8669..c05d460 100644 --- a/pkg/instance/status.go +++ b/pkg/instance/status.go @@ -13,18 +13,21 @@ const ( Stopped Status = iota Running Failed + Restarting ) var nameToStatus = map[string]Status{ - "stopped": Stopped, - "running": Running, - "failed": Failed, + "stopped": Stopped, + "running": Running, + "failed": Failed, + "restarting": Restarting, } var statusToName = map[Status]string{ - Stopped: "stopped", - Running: "running", - Failed: "failed", + Stopped: "stopped", + Running: "running", + Failed: "failed", + Restarting: "restarting", } // Status enum JSON marshaling methods