fix: clean up activeShards on reconnection failure

Remove stale entries from the activeShards map when
reconnectWithBackoff exhausts all attempts or detects room closure.

Made-with: Cursor
This commit is contained in:
cottongin
2026-03-20 11:34:15 -04:00
parent 2503c3fc09
commit 03f79422af

View File

@@ -378,6 +378,7 @@ class EcastShardClient {
reason: 'room_closed', reason: 'room_closed',
finalPlayerCount: this.playerCount, finalPlayerCount: this.playerCount,
}); });
activeShards.delete(`${this.sessionId}-${this.gameId}`);
return false; return false;
} }
@@ -397,6 +398,7 @@ class EcastShardClient {
reason: 'connection_failed', reason: 'connection_failed',
finalPlayerCount: this.playerCount, finalPlayerCount: this.playerCount,
}); });
activeShards.delete(`${this.sessionId}-${this.gameId}`);
return false; return false;
} finally { } finally {
this.reconnecting = false; this.reconnecting = false;