Skip to content

Matchmaking cron scans queue table every 10s — query plan is full scan + sort #99

Description

@mercy60

Internal ID: #98

Imported from ISSUES.md via scripts/import-issues.mjs.

Problem Statement. MultiplayerQueueService::processMatchmaking:

const waitingPlayers = await this.queueRepository.find({
  where: { status: QueueStatus.WAITING },
  order: { createdAt: "ASC" },
});

No index on (status, createdAt) is mentioned in the entity. With 10k queued users, it's a full table scan every 10 seconds.

Expected Outcome.

  • Index on (status, created_at).
  • Matchmaking limited to N oldest waiters, e.g. 200.

Acceptance Criteria.

  • 10k rows, cron completes in < 200ms.

Files / modules affected.

  • backend/src/multiplayer-queue/entities/queue.entity.ts

Dependencies. None.

Difficulty / Effort. Medium / S (≈ 3 hours).

Labels. area:backend, performance, priority:high

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programarea:backendImported from ISSUES.mdperformanceImported from ISSUES.mdpriority:highImported from ISSUES.md

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions