AOSSIE-Org / AOSSIE-Org/DebateAI

[Bug] Online Matchmaking Gets Stuck in “Searching” State

Abierto
#203 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
84
Forks
198
Merge medio
2 d 19 h
PR fusionados (30 d)
30

Descripción

### 📌 Description
When a user joins **Online Matchmaking**, the UI correctly shows the user as being added to the queue and the search timer starts. However, **no match is ever created**, even when compatible players are present or when multiple users join the queue over time.

This results in users being stuck indefinitely in the **“Searching…”** state.

---

### 🔁 Steps to Reproduce
1. Go to **Start Debate → Matchmaking**
2. Click **Find a Debate Partner**
3. Observe:
- Timer starts (`Searching…`)
- User appears under **Players in Queue**
4. Open another browser or incognito window with a different account
5. Join matchmaking again with a compatible Elo range
6. ❌ No match is created; both users remain in the queue

---

### 📷 Screenshot

Image

### ✅ Expected Behavior
- When two compatible users (with overlapping Elo ranges) are present in the queue:
- A debate room should be created automatically
- Both users should be removed from the queue
- Both clients should receive a `match_found` WebSocket event
- Users should be redirected to the debate room

---

### ❌ Actual Behavior
- Users are successfully added to the matchmaking queue
- The search timer continues indefinitely
- No debate room is created
- No `match_found` event is emitted
- Users must manually cancel matchmaking

---

### 🧠 Possible Root Causes
- Matchmaking logic runs **only once on join**, not periodically
- No background worker or loop to continuously check the queue
- Elo range matching condition may be too strict or incorrect
- Matched users are not removed atomically from the queue
- Match creation event is not emitted over WebSocket

---

### 💡 Suggested Fix
- Add a **periodic matchmaking worker** (e.g., every 1 second) to process the queue
- Use **overlapping Elo range matching logic**
- Ensure matched users are removed atomically from the queue
- Emit a `match_found` WebSocket event to both matched users

---

#### 🧪 Environment

- OS: Any
- Browser: Chrome / Firefox
- Frontend: React (Vite)
- Backend: Go
- Matchmaking Mode: Online Matchmaking

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.