From 9666676766bf21364f4fc4d0d1d336e72f2a91b4 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Tue, 6 Oct 2026 12:57:23 -0400 Subject: refactor: split casino.go, dedup helpers, remove audit docs --- internal/game/owner.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'internal/game/owner.go') diff --git a/internal/game/owner.go b/internal/game/owner.go index d4d3839..3954ab7 100644 --- a/internal/game/owner.go +++ b/internal/game/owner.go @@ -172,7 +172,13 @@ func (g *Game) run(fn func()) { // TestShutdownRejectsSessionInput. return } - <-task + select { + case <-task: + case <-o.done: + // The owner goroutine exited without draining the queue (a task + // called runtime.Goexit, e.g. a test's t.Fatal). Return instead of + // blocking forever on a task that no longer has a consumer. + } } // adminTaskPanic is the value RunAdminOnOwner re-raises on its caller's @@ -222,7 +228,12 @@ func (g *Game) RunAdminOnOwner(fn func()) bool { }) { return false } - <-done + select { + case <-done: + case <-g.owner.done: + // Owner goroutine exited; treat as a refused task rather than hanging. + return false + } if !finished { panic(adminTaskPanic) } -- cgit v1.2.3