diff --git a/paskia/satellite.py b/paskia/satellite.py index ba5ecaf..c5d62db 100644 --- a/paskia/satellite.py +++ b/paskia/satellite.py @@ -147,16 +147,19 @@ class RemoteReplica: ready_at = 0.0 try: while True: - if staging is None: + if ready_at: # Periodic reconnects give full-snapshot reconciliation remaining = self.remote.refresh_interval - ( time.monotonic() - ready_at ) if remaining <= 0: return - message = msgspec.json.decode( - await asyncio.wait_for(ws.recv(), remaining) - ) + try: + message = msgspec.json.decode( + await asyncio.wait_for(ws.recv(), remaining) + ) + except TimeoutError: + return # periodic resync: reconnect for a snapshot else: message = msgspec.json.decode(await ws.recv()) mtype = message.get("type")