Skip to content

Commit a2159ea

Browse files
KaboomFoxclaude
andcommitted
Skip data timeout for shards with few subscriptions
Shards with < 50 subscriptions are exempt from data timeout since they likely contain low-activity tokens that may not receive any updates within the timeout window. This prevents constant false-positive hot switchover loops on tail shards. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 974e19e commit a2159ea

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/connection.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,9 @@ impl<H: WebSocketHandler> Connection<H> {
490490
}
491491
}
492492

493-
// Check data timeout
494-
if health.is_data_timeout() {
493+
// Check data timeout (skip for shards with few subscriptions - they may have low-activity tokens)
494+
// Shards with < 50 subscriptions are exempt since inactive markets may not send data
495+
if health.is_data_timeout() && state.subscription_count >= 50 {
495496
self.metrics.record_health_failure();
496497

497498
// Request hot switchover if channel available, otherwise regular reconnect

0 commit comments

Comments
 (0)