From cc33072eced3d5460512c09c42ec4531c807d7af Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Sat, 19 Sep 2026 01:55:34 -0400 Subject: fix: casino stake preservation, world state reconciliation, casino game registration --- internal/admin/api_map.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'internal/admin/api_map.go') diff --git a/internal/admin/api_map.go b/internal/admin/api_map.go index d0372df..231f52b 100644 --- a/internal/admin/api_map.go +++ b/internal/admin/api_map.go @@ -246,6 +246,10 @@ func (s *AdminServer) handleMap(w http.ResponseWriter, r *http.Request) { var upLinks []UDLink var downLinks []UDLink + // Hoist the room index once: RoomIndex builds a fresh map copy under the + // world lock, and calling it per exit made this loop O(rooms x exits x + // rooms) with a mutex acquisition each time. + roomIndex := s.world.RoomIndex() seenLinks := make(map[string]bool) for rid, room := range roomData { c := g.Coord[rid] @@ -255,7 +259,7 @@ func (s *AdminServer) handleMap(w http.ResponseWriter, r *http.Request) { continue } targetCoord, hasCoord := g.Coord[target] - targetExists := s.world.RoomIndex()[target] + _, targetExists := roomIndex[target] if !targetExists || !hasCoord { if dir != world.Up && dir != world.Down { -- cgit v1.2.3