AOSSIE-Org / AOSSIE-Org/DebateAI

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

Đang mở
#203 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
84
Fork
198
Merge trung bình
2 ngày 19 giờ
Pull request đã merge (30 ngày)
30

Mô tả

### 📌 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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.