From: Carl Worth Date: Sun, 8 Mar 2026 23:13:53 +0000 (-0400) Subject: anagrams: Restart any necessary timers when restoring a game X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=16923601694569ec6dea85c6642b554515fa5c59;p=lmno-server anagrams: Restart any necessary timers when restoring a game This could give some extra time to the current in-progress claim/vote, but that's fine, (and better than leaving the timer un-started which could result in a hung game if a player has been disconnected). --- diff --git a/anagrams.js b/anagrams.js index c0e3be8..1ec3cb4 100644 --- a/anagrams.js +++ b/anagrams.js @@ -853,6 +853,13 @@ class Anagrams extends Game { restore(data) { super.restore(data); this.state.done_players = new Set(this.state.done_players); + + /* Restart timers that were active at save time. */ + if (this.state.vote_pending) { + this._vote_timer = setTimeout(() => this._resolve_vote(), VOTE_TIMEOUT_MS); + } else if (this.state.claim_queue.length > 0) { + this._activate_claimer(); + } } }