A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
fix(rexctl): say what to check when a service stalls (#3612)
Hampusbe9a84eb70f8
diff --git a/fluxer_rexctl/cmd/lifecycle.go b/fluxer_rexctl/cmd/lifecycle.goindex 073ba1d32..10cee12a4 100644--- a/fluxer_rexctl/cmd/lifecycle.go+++ b/fluxer_rexctl/cmd/lifecycle.go@@ -26,8 +26,9 @@ import ()const (- bootLockWait = 10 * time.Minute- bootRouteWait = 2 * time.Minute+ bootLockWait = 10 * time.Minute+ bootRouteWait = 2 * time.Minute+ readyHintAfter = 3 * time.Minute)type logPart struct {@@ -257,11 +258,27 @@ func waitForFluxer(ctx context.Context, inst *instance.Instance, p *engine.Proje}func showReadiness(s *ui.Step, prefix string) func(engine.Readiness) {+ start, hinted := time.Now(), falsereturn func(r engine.Readiness) {waiting := slices.Concat(r.NotReady, r.Failed)slices.Sort(waiting)showWaiting(s, prefix, len(r.Ready), len(r.Ready)+len(waiting), "ready", waiting)+ if !hinted && len(waiting) > 0 && time.Since(start) >= readyHintAfter {+ hinted = true+ s.Info("%s", notReadyHint(waiting))+ }+ }+}++func notReadyHint(waiting []string) string {+ if len(waiting) == 1 && slices.Contains(stack.Services, waiting[0]) {+ return fmt.Sprintf("%s isn't ready after %d minutes. Run rexctl logs %s in another terminal to see why.", waiting[0], int(readyHintAfter.Minutes()), waiting[0])+ }+ verb := "aren't"+ if len(waiting) == 1 {+ verb = "isn't"}+ return fmt.Sprintf("%s %s ready after %d minutes. Run rexctl logs in another terminal to see why.", waitingFor(waiting), verb, int(readyHintAfter.Minutes()))}func showWaiting(s *ui.Step, prefix string, done, total int, state string, waiting []string) {diff --git a/fluxer_rexctl/internal/ui/step.go b/fluxer_rexctl/internal/ui/step.goindex a66809498..5f2e28ba4 100644--- a/fluxer_rexctl/internal/ui/step.go+++ b/fluxer_rexctl/internal/ui/step.go@@ -78,6 +78,10 @@ func (s *Step) Done(format string, args ...any) {s.mu.Unlock()}+func (s *Step) Info(format string, args ...any) {+ s.ui.Info(format, args...)+}+func (s *Step) Log(line string) {s.mu.Lock()s.logs = append(s.logs, line)