Compare commits

...

1 Commits

Author SHA1 Message Date
Timmy
93b8475405 fix(#1356): replace HTTPServer with ThreadingHTTPServer in multi-user bridge
Some checks failed
CI / test (pull_request) Failing after 2s
Review Approval Gate / verify-review (pull_request) Failing after 8s
CI / validate (pull_request) Failing after 40s
The single-threaded HTTPServer queues requests sequentially, causing
60% timeout under 10 concurrent users (30s timeout, 7.8s avg).

Fix: use ThreadingHTTPServer (already defined in multi_user_bridge.py)
for thread-per-request concurrency.

- multi_user_bridge.py: line 2883 HTTPServer -> ThreadingHTTPServer
- world/multi_user_bridge.py: add ThreadingMixIn import + class, fix server init

Refs #1356
2026-04-13 17:23:47 -04:00
2 changed files with 9 additions and 3 deletions

View File

@@ -2880,7 +2880,7 @@ def main():
# Start world tick system
world_tick_system.start()
server = HTTPServer((BRIDGE_HOST, BRIDGE_PORT), BridgeHandler)
server = ThreadingHTTPServer((BRIDGE_HOST, BRIDGE_PORT), BridgeHandler)
server.serve_forever()

View File

@@ -26,11 +26,17 @@ import threading
import hashlib
import os
import sys
from http.server import HTTPServer, BaseHTTPRequestHandler
from http.server import BaseHTTPRequestHandler, HTTPServer
from socketserver import ThreadingMixIn
from pathlib import Path
from datetime import datetime
from typing import Optional
class ThreadingHTTPServer(ThreadingMixIn, HTTPServer):
"""Thread-per-request HTTP server."""
daemon_threads = True
# ── Configuration ──────────────────────────────────────────────────────
BRIDGE_PORT = int(os.environ.get('TIMMY_BRIDGE_PORT', 4004))
@@ -274,7 +280,7 @@ def main():
print(f" POST /bridge/move — Move user to room (user_id, room)")
print()
server = HTTPServer((BRIDGE_HOST, BRIDGE_PORT), BridgeHandler)
server = ThreadingHTTPServer((BRIDGE_HOST, BRIDGE_PORT), BridgeHandler)
server.serve_forever()