Skip to content

fix: send CancelHistoricalData when streaming subscription is dropped#430

Merged
wboayue merged 1 commit intomainfrom
fix/427-cancel-historical-data-streaming
Feb 24, 2026
Merged

fix: send CancelHistoricalData when streaming subscription is dropped#430
wboayue merged 1 commit intomainfrom
fix/427-cancel-historical-data-streaming

Conversation

@wboayue
Copy link
Copy Markdown
Owner

@wboayue wboayue commented Feb 24, 2026

Summary

  • Fixes historical_data_streaming subscription with keep_up_to_date is never cancelled #427: historical_data_streaming subscriptions now send CancelHistoricalData to the server when dropped or explicitly cancelled
  • Added encode_cancel_historical_data encoder (message type 25, version 1, request_id)
  • Wired both async and sync HistoricalDataStreamingSubscription with request_id, message_bus, and cancelled flag
  • Async Drop uses tokio::spawn to send the cancel message; sync Drop delegates to cancel()
  • Idempotent: explicit cancel() followed by drop only sends one cancel message

Test plan

  • test_encode_cancel_historical_data — verifies encoder output
  • test_streaming_subscription_sends_cancel_on_drop (async + sync) — verifies cancel message sent on drop
  • test_streaming_subscription_cancel_prevents_duplicate_on_drop (async + sync) — verifies idempotency
  • All existing tests pass across default, sync-only, and all-features configurations
  • Clippy clean, formatted

…#427)

historical_data_streaming used send_raw bypassing the Subscription<T>
cancel-on-drop mechanism. Added encode_cancel_historical_data encoder
and wired both async/sync HistoricalDataStreamingSubscription to send
the cancel message on drop.
@wboayue wboayue force-pushed the fix/427-cancel-historical-data-streaming branch from 5f5ad98 to edafe23 Compare February 24, 2026 19:33
@wboayue wboayue merged commit eb98f3c into main Feb 24, 2026
3 checks passed
@wboayue wboayue deleted the fix/427-cancel-historical-data-streaming branch February 24, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

historical_data_streaming subscription with keep_up_to_date is never cancelled

1 participant