AOSSIE-Org / AOSSIE-Org/DebateAI

race condition, we need to change the logic so users are not removed from the pool until the room is successfully created in the database.

Open
#301 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
84
Forks
198
Avg merge
2d 19h
Merged PRs (30d)
30

Description

**Location:** `backend/services/matchmaking.go`
### Suppose
**Issue** explained :

- Alice and Bob are waiting in line outside a popular restaurant (The Matchmaking Pool).
- (The System) sees that Alice and Bob are a perfect match for a 2-person table.
- To ensure no other host grabs them, the Maître D' immediately crosses their names off the waiting list (Removes from Pool).
- He then walks them to the private dining room.
- The Problem: When they arrive, the door is jammed, or the table has collapsed (Database/Room Creation Error).
- The (The System) can't seat them, so he leaves them in the hallway.
- The Limbo: Alice and Bob go back to the front desk, but their names are already crossed off the list.
- The other staff think they are already eating.
- Alice and Bob stand in the lobby forever, never getting a table, but unable to get back in line.

### Fix Strategy: "Reserve" before "Remove"

- Add State: Add an IsMatching flag to the user struct.

- Reserve: In findMatch, set IsMatching = true (locking the users) instead of deleting them.

- Commit/Rollback: In createRoomForMatch, delete them on success, or reset IsMatching = false on failure.

@bhavik-mangla Please review the solution here #302

Contributor guide

No contributing guide indexed for this repository

Research direction

Open backend/services/matchmaking.go and inspect findMatch and createRoomForMatch, then review the proposed solution in issue #302. Trace the matching and room-creation failure paths; done means users are unavailable to competing matches while a room is being created, removed after success, and eligible again after failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.