oettaM123 Claude Opus 4.8 commited on
Commit
b5f27aa
·
1 Parent(s): 7c93c6e

Lookup: cut live-lookup timeout 5s->3s (kill the ~12s hang)

Browse files

Measured the lookup latency bimodal: reachable accounts answer GetPlayerInfo
in <0.8s (slowest real responder 2.3s), unreachable ones never answer. With
the old 5s per-phase timeout and 2 room attempts, a dead lookup hung ~12s and
tied up a worker thread the whole time -> also made the leaderboard sluggish.
3s cleanly separates responders; non-responders fall back fast to the cached
leaderboard row, and the 2nd room attempt still covers other world instances.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -26,7 +26,13 @@ STATIC_DIR = APP_DIR / "static"
26
  TOOLS_DIR = APP_DIR / "tools"
27
  SM_LOADBALANCER_BASE = _os.getenv("SM_LOADBALANCER_BASE", "https://loadbalancer.swordmasters.io").rstrip("/")
28
  SM_LOOKUP_WORLD = _os.getenv("SM_LOOKUP_WORLD", "world_1")
29
- SM_LOOKUP_TIMEOUT = max(2.0, float(_os.getenv("SM_LOOKUP_TIMEOUT", "5.0")))
 
 
 
 
 
 
30
  SM_LOOKUP_CACHE_SECONDS = max(1.0, float(_os.getenv("SM_LOOKUP_CACHE_SECONDS", "15.0")))
31
  SM_LOOKUP_MAX_USERNAMES = max(1, int(_os.getenv("SM_LOOKUP_MAX_USERNAMES", "50")))
32
  SM_LOOKUP_QUERY_INTERVAL = max(0.0, float(_os.getenv("SM_LOOKUP_QUERY_INTERVAL", "0.02")))
 
26
  TOOLS_DIR = APP_DIR / "tools"
27
  SM_LOADBALANCER_BASE = _os.getenv("SM_LOADBALANCER_BASE", "https://loadbalancer.swordmasters.io").rstrip("/")
28
  SM_LOOKUP_WORLD = _os.getenv("SM_LOOKUP_WORLD", "world_1")
29
+ # Pro Lookup-Phase (connect/join/reply-wait). GEMESSEN bimodal: erreichbare Accounts antworten
30
+ # <0,8s (langsamster echter Responder 2,3s), nicht erreichbare NIE -> der alte 5s-Default liess
31
+ # einen toten Lookup ROOM_ATTEMPTS x ~5s ≈ 12s haengen und blockierte solange einen Worker-Thread
32
+ # (-> machte auch das Leaderboard traege). 3s trennt Responder sauber ab, Nicht-Responder fallen
33
+ # schnell auf den Store-Fallback (_sm_cached_leaderboard_row_for_username); der 2. Attempt
34
+ # (SM_LOOKUP_ROOM_ATTEMPTS) faengt Accounts in anderen Welt-Instanzen weiterhin ab.
35
+ SM_LOOKUP_TIMEOUT = max(2.0, float(_os.getenv("SM_LOOKUP_TIMEOUT", "3.0")))
36
  SM_LOOKUP_CACHE_SECONDS = max(1.0, float(_os.getenv("SM_LOOKUP_CACHE_SECONDS", "15.0")))
37
  SM_LOOKUP_MAX_USERNAMES = max(1, int(_os.getenv("SM_LOOKUP_MAX_USERNAMES", "50")))
38
  SM_LOOKUP_QUERY_INTERVAL = max(0.0, float(_os.getenv("SM_LOOKUP_QUERY_INTERVAL", "0.02")))