Archived
feat(polymarket): subscription monitoring and connection recycling
The exchange can fail without telling us, and first one wins hides a subscription gone quiet on one of a symbol's two connections. - A connection that receives nothing for 30 s, not even the keepalive's answer, reconnects. - Each book thread counts a symbol's changes per connection every minute: a subscription with none against three or more on the other is resubscribed, and moved to another connection if it stays quiet. - The orchestrator recycles one connection at a time, each about hourly, and never while another connection is down or just back. - A reconnect's opening book of a symbol unchanged for 10 s is judged like a resync's answer: one newer than ours that differs shows a symbol quiet on both connections, written as a Snapshot and logged as a loss.
This commit is contained in:
10 files changed
+1346
-102
No files matched your search
@@ -71,6 +71,14 @@ mod tests {
|
||||
let logged = format!("12:00:00.001 polymarket: {text}");
|
||||
assert_eq!(parse(&logged), Some(("123".to_string(), at, cause)));
|
||||
}
|
||||
// A reconnect's loss says how it was found, after its cause.
|
||||
let text = line(
|
||||
"123",
|
||||
at,
|
||||
Cause::Loss,
|
||||
", found by a reconnect (its time 12:00:00.000)",
|
||||
);
|
||||
assert_eq!(parse(&text), Some(("123".to_string(), at, Cause::Loss)));
|
||||
assert_eq!(
|
||||
parse("12:00:00.001 polymarket: connection 3: connected"),
|
||||
None
|
||||
|
||||
Reference in new issue
Block a user