Conversation
PR Review: Add Pinger RoutineOverall this looks solid — the approach of application-level pings (JSON Issues1. Unused import 2. Exception swallowing — silent behavioral change
This could mask real bugs. Consider either re-raising after cleanup, or separating "expected" close/disconnect errors from unexpected ones. At minimum, callers who previously relied on exceptions propagating from 3. Minor race condition in finally:
stop_event.set()
self.ws = None # ← clears ws
if ping_thread:
ping_thread.join() # ← ping thread may still be mid-sendThe ping thread could be between the finally:
stop_event.set()
if ping_thread:
ping_thread.join(timeout=1)
self.ws = None # clear after thread has exitedNote: the async version already does this correctly (cancels task → gathers → then clears Looks Good
SummaryThe core ping/pong logic is correct and will work. The main concern is #2 (exception swallowing) which is a behavioral change that could hide bugs from callers. #1 is trivial cleanup, and #3 is a minor race that won't crash but should be tidied up for correctness. |
Re-Review after
|
No description provided.