aboutsummaryrefslogtreecommitdiff
path: root/internal/game/owner.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-10-06 12:57:23 -0400
committerhistoria <[not public]>2026-10-06 12:57:23 -0400
commit9666676766bf21364f4fc4d0d1d336e72f2a91b4 (patch)
tree0cade34091d7602790dc38cd44053f0b74bbadf2 /internal/game/owner.go
parent4bc1daaf259e0c19c5fe4a12ec8bc7f6e5a735c1 (diff)
downloadthehouseoficarus-9666676766bf21364f4fc4d0d1d336e72f2a91b4.tar.gz
refactor: split casino.go, dedup helpers, remove audit docs
Diffstat (limited to 'internal/game/owner.go')
-rw-r--r--internal/game/owner.go15
1 files changed, 13 insertions, 2 deletions
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)
}