asobi_lua_config_watcher (asobi v0.75.1)

View Source

Keeps the game-mode registry (game_modes) in sync with its Lua source.

Mode-shape config (match_size, strategy, max_players, the config.lua mode manifest) is read once at boot by asobi_lua_config:maybe_load_game_config/0 and applied via asobi_game_config:apply_config/1. The in-match hot-reload (asobi_lua_reload) re-evaluates a script body inside already-running match and world servers, but the reported bug is at match formation - before any server exists for the new config - so that path is structurally blind to it. Without a refresh, editing match_size and hot-reloading leaves the matchmaker on the boot-time value (asobi#232).

This watcher polls the manifest and each registered mode's script on an interval and re-runs the config loader when an mtime moves, so new matches pick up the change. Running matches are untouched (they consumed their match_size at formation). It shares the hot-reload dial: with asobi_lua_reload:reload_mode() off (a sealed prod bundle whose mtimes never change) it is a pure no-op.

Summary

Functions

handle_call(Request, From, State)

-spec handle_call(term(), gen_server:from(), map()) -> {reply, term(), map()}.

handle_cast(Msg, State)

-spec handle_cast(term(), map()) -> {noreply, map()}.

handle_info/2

-spec handle_info(term(), map()) -> {noreply, map()}.

init/1

-spec init([]) -> {ok, map()}.

start_link()

-spec start_link() -> gen_server:start_ret().