aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/api_map.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/admin/api_map.go')
-rw-r--r--internal/admin/api_map.go6
1 files changed, 5 insertions, 1 deletions
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 {