Skip to content

Commit 54e2841

Browse files
committed
fix(async): handle SignalR CompletionMessage as debug not error
- Add check for CompletionMessage type in _on_connection_error - Log as debug instead of error for normal protocol messages - Only increment error counter for actual errors - Fixes spurious 'Market hub error' messages in logs
1 parent 84b867b commit 54e2841

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/project_x_py/async_realtime.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,14 @@ def _on_market_hub_close(self):
627627

628628
def _on_connection_error(self, hub: str, error):
629629
"""Handle connection errors."""
630+
# Check if this is a SignalR CompletionMessage (not an error)
631+
error_type = type(error).__name__
632+
if "CompletionMessage" in error_type:
633+
# This is a normal SignalR protocol message, not an error
634+
self.logger.debug(f"SignalR completion message from {hub} hub: {error}")
635+
return
636+
637+
# Log actual errors
630638
self.logger.error(f"❌ {hub.capitalize()} hub error: {error}")
631639
self.stats["connection_errors"] += 1
632640

0 commit comments

Comments
 (0)