aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-15 20:14:02 -0400
committerhistoria <[not public]>2026-09-15 20:14:02 -0400
commit69235cac5b3da5ff0dc20310e7474cabd8e63ba3 (patch)
treece96c9506531e219c157f29ac6a6dc53de1df15b /cmd
parent6f3c43aca62a7d33a19f14f6ad7c16891952673a (diff)
downloadthehouseoficarus-69235cac5b3da5ff0dc20310e7474cabd8e63ba3.tar.gz
feat: route all html editor API mutations through single owner task
Diffstat (limited to 'cmd')
-rw-r--r--cmd/thoi/main.go25
1 files changed, 9 insertions, 16 deletions
diff --git a/cmd/thoi/main.go b/cmd/thoi/main.go
index 2031cb6..a07fbcc 100644
--- a/cmd/thoi/main.go
+++ b/cmd/thoi/main.go
@@ -64,23 +64,16 @@ func main() {
}
g.SetHub(server.Hub())
- // Admin mutation callbacks execute on the game's owner goroutine: the
- // admin HTTP goroutine must not touch live players or world state.
- // MigrateRoomIDs is the complete room-ID migration (players, Hub
- // membership, casino room keys, world state, mob instances).
- adminRewriteRoomIDs := g.MigrateRoomIDs
- adminRebuildCraftIndex := func() {
- g.RunOnOwner(func() { g.RebuildCraftIndex() })
- }
- adminEvictRoom := func(roomID int) {
- g.RunOnOwner(func() { g.EvictCasinoRoom(roomID) })
- }
- adminReloadCourses := func() {
- g.RunOnOwner(func() { g.CourseStore.ReloadAll() })
- }
+ // The entire editor API request is one owner task, including file commits,
+ // runtime migration, undo history and reloads. These callbacks already run
+ // on the owner and MUST NOT redispatch (that would deadlock).
+ adminRewriteRoomIDs := g.MigrateRoomIDsOnOwner
+ adminRebuildCraftIndex := g.RebuildCraftIndex
+ adminEvictRoom := g.EvictCasinoRoom
+ adminReloadCourses := g.CourseStore.ReloadAll
if cfg.AdminHTTP.Enabled {
- adminSrv, err := admin.NewServer(cfg, false, g.AccountStore, g.World, g.ItemStore, g.ObjectStore, g.MobStore, dataDir, adminReloadCourses, adminRewriteRoomIDs, adminEvictRoom, adminRebuildCraftIndex, *configPath)
+ adminSrv, err := admin.NewServer(cfg, false, g.AccountStore, g.World, g.ItemStore, g.ObjectStore, g.MobStore, dataDir, adminReloadCourses, adminRewriteRoomIDs, adminEvictRoom, adminRebuildCraftIndex, *configPath, g.RunAdminOnOwner)
if err != nil {
log.Fatalf("failed to start admin HTTP server: %v", err)
}
@@ -93,7 +86,7 @@ func main() {
}
if cfg.AdminHTTPS.Enabled {
- adminSrv, err := admin.NewServer(cfg, true, g.AccountStore, g.World, g.ItemStore, g.ObjectStore, g.MobStore, dataDir, adminReloadCourses, adminRewriteRoomIDs, adminEvictRoom, adminRebuildCraftIndex, *configPath)
+ adminSrv, err := admin.NewServer(cfg, true, g.AccountStore, g.World, g.ItemStore, g.ObjectStore, g.MobStore, dataDir, adminReloadCourses, adminRewriteRoomIDs, adminEvictRoom, adminRebuildCraftIndex, *configPath, g.RunAdminOnOwner)
if err != nil {
log.Fatalf("failed to start admin HTTPS server: %v", err)
}