Skip to content

perf: only fetch profiles for newly online players - #586

Merged
lukepolo merged 1 commit into
mainfrom
perf/online-players-incremental-fetch
Sep 19, 2026
Merged

lukepolo merged 1 commit into
mainfrom
perf/online-players-incremental-fetch

Conversation

@lukepolo

@lukepolo lukepolo commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Presence is pushed as a full roster, so any single connect or disconnect re-fetched every online player's profile — elo plus three sanction checks each — in every open tab.

On prod that query is the single largest database consumer at 15.6% of top-level DB CPU (242,840 calls over 31h, 281ms mean).

Caches profiles for the length of a session, fetches only steam ids not already held, and debounces the presence bursts.

Side effect: playersOnline now clears when the roster empties, where it previously kept a stale list.

Presence is pushed as a full roster, so any single connect or disconnect
re-fetched every online player's profile -- elo plus three sanction
checks each -- in every open tab. On prod that query is 15.6% of all
database CPU. Cache profiles for the length of a session, ask only for
steam ids not already held, and debounce the presence bursts.
@lukepolo
lukepolo merged commit 2ddbca1 into main Sep 19, 2026
2 checks passed
@lukepolo
lukepolo deleted the perf/online-players-incremental-fetch branch September 19, 2026 20:02
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.

1 participant