From bf5cd9f9f0bdbdbf7c1bef9e1e582ee27ed901f0 Mon Sep 17 00:00:00 2001 From: Yoann Lecuyer Date: Sun, 30 Nov 2025 00:27:04 +0100 Subject: [PATCH] Fix: race condition for pause/unpause state --- pkg/gui/gui.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index fa6199f3..c32d602f 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -363,6 +363,18 @@ outer: case <-ctx.Done(): return case message := <-messageChan: + switch message.Type { + case events.ContainerEventType: + switch message.Action { + case events.ActionPause, events.ActionUnPause: + // pause/unpause events are lonely events + // add tiny delay to allow state to stabilise + // other events don't need that as they are followed by other events + // which give time for state to stabilise and be picked up by our refreshes + time.Sleep(200 * time.Millisecond) + } + } + // We could be more granular about what events should trigger which refreshes. // At the moment it's pretty efficient though, and it might not be worth // the maintenance burden of mapping specific events to specific refreshes