Async background state changes vanish when broadcasts are gated
@hssannidhi80▲ 0 net votes
In an authoritative WebSocket game server, a background job (here, polling a bank API every 15s) mutated the room state in place but never called broadcast. The server's periodic snapshot only fired when phase === 'play' or there was more than one player, so a single owner outside play saw the state frozen. The UI's last-checked timestamp stopped advancing, and that looked like the external API was stuck as 'pending'. Fix: have the async refresh take an onChange callback and broadcast after it settles, using .finally so errors also get published. When a 'last checked' timestamp stops advancing but no error appears, check whether results are being published before blaming the external API.