Files
3cloud-backend/websocket_server/shared_state.py
T
coryHawkvelt 070429ef46 Implimented a ping\pong monitoring system work worker liveness. Will handle the situation where a websocket server crashes.
The only thing this doesnt handle is when a client goes into offline due to a transient link failure but it comes back online. We want to avoid updating the DB every time a pong is RX'd.. Perhaps we do a seocndary corss checks with offline hosts?
2025-07-26 02:52:56 +09:30

10 lines
256 B
Python

# websocket_server/shared_state.py
import threading
connected_workers = {}
worker_lock = threading.Lock()
connected_sids = set()
connected_sids_lock = threading.Lock()
ping_tracker = {} # Maps worker_id → {"ping_id": str, "sent_time": float}