From f94d05dad2f9d392814d92b7008e47b666e7ea25 Mon Sep 17 00:00:00 2001 From: LordMathis Date: Sun, 26 Oct 2025 18:55:05 +0100 Subject: [PATCH] Add Restarting state --- pkg/instance/process.go | 4 ++++ pkg/instance/status.go | 15 +++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) 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