Fix sync client resync condition (ready-tracked, not staging)
This commit is contained in:
+7
-4
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user