Repository navigation
Conversation
…round A freed slot was only filled on the next enqueue into the same queue: a player waiting in queue could never enter a running battleground that lost a member. Kick the queue pass (backfill, then creation) right after the slot is freed.
There was a problem hiding this comment.
🟡 Changes recommended
The new async backfill trigger can overlap concurrent queue process runs and cause duplicate invites/links without a per-queue serialization/coalescing mechanism.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR improves battleground backfilling by triggering a queue processing pass immediately after a player leaves an active battleground, so an already-waiting group can be invited right away instead of waiting for the next enqueue.
Changes:
- Added
ProcessBackfill(ctx)to thePVPQueueinterface and implemented it forGenericBattlegroundQueueandBattlegroundRandomQueue. - Updated
PlayerLeftBattlegroundto trigger an async backfill pass for the affected queue/bracket after removing the player.
File summaries
| File | Description |
|---|---|
| apps/matchmakingserver/service/battleground-random-queue.go | Exposes ProcessBackfill on the random-queue wrapper by delegating to the underlying generic queue. |
| apps/matchmakingserver/service/battleground-queue.go | Extends PVPQueue with ProcessBackfill and routes it to the existing process logic. |
| apps/matchmakingserver/service/battleground_service.go | Triggers a queue backfill pass after PlayerLeftBattleground updates the battleground state. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+152
to
+154
| func (q *GenericBattlegroundQueue) ProcessBackfill(ctx context.Context) error { | ||
| return q.process(ctx) | ||
| } |
Comment on lines
+656
to
+661
| go func() { | ||
| if err := queue.ProcessBackfill(context.Background()); err != nil { | ||
| log.Err(err).Msg("backfill pass after player left battleground failed") | ||
| } | ||
| }() | ||
| } |
…fill pass Review follow-ups: group selection in process() happens under a read lock and removal only after the invite, so two overlapping runs (concurrent enqueues, or the new leave-triggered backfill racing an enqueue) could invite the same queued group twice - a dedicated mutex now serializes process() runs. The backfill goroutine also gets a 10s deadline so a stalled pass can't accumulate hung goroutines.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A freed slot was only filled on the next enqueue into the same queue: a player already waiting could never enter a running battleground that lost a member, and the match stayed short-handed until someone new queued.
This kicks the regular queue pass (backfill first, then creation) right after the slot is freed, so the replacement is invited immediately. Verified live on my cluster: a leaver's seat is re-offered within a second and the joiner lands in the running match.