Skip to content

fix: add proper resource disposal for HttpClient, WebSocket, timers, and pending messages#137

Open
Flegma wants to merge 1 commit intomainfrom
audit/398-resource-disposal
Open

fix: add proper resource disposal for HttpClient, WebSocket, timers, and pending messages#137
Flegma wants to merge 1 commit intomainfrom
audit/398-resource-disposal

Conversation

@Flegma
Copy link
Copy Markdown
Contributor

@Flegma Flegma commented Apr 8, 2026

Summary

  • Wrap HttpClient in using statement in MatchService.GetMatchFromApi()
  • Dispose _retryTimer and _webSocket in MatchEvents.Disconnect(); dispose old WebSocket in Connect() before replacement
  • Cap _pendingMessages at 1000 entries to prevent unbounded growth
  • Clear entire _disconnectTimers dictionary in SurrenderSystem.Reset()

Closes 5stackgg/5stack-panel#398

Test plan

  • Verify match data fetching works after HttpClient disposal change
  • Verify WebSocket reconnection works correctly
  • Verify surrender timer cleanup works after Reset()

…and pending messages

Wrap HttpClient in using statement in MatchService.GetMatchFromApi.
Dispose _retryTimer and _webSocket in MatchEvents.Disconnect. Dispose
old WebSocket before replacement in Connect. Cap _pendingMessages at
1000 entries. Clear entire _disconnectTimers dictionary in
SurrenderSystem.Reset.
@Flegma Flegma requested a review from lukepolo April 10, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Game Server] Resource disposal — HttpClient, WebSocket, Timer, pending messages accumulation

1 participant