Skip to content

Preserve live request batch boundaries on reconnect - #144

Open
ItsM0rty wants to merge 1 commit into
databento:mainfrom
ItsM0rty:code-fix/reconnect-batch-boundaries
Open

ItsM0rty wants to merge 1 commit into
databento:mainfrom
ItsM0rty:code-fix/reconnect-batch-boundaries

Conversation

@ItsM0rty

Copy link
Copy Markdown

Description

After reconnect, a subscribe or unsubscribe request w/ 501 symbols can replay as [1, 1] instead of [0, 1]. That tells the gateway to process the first chunk before the rest of the request arrives.

The fix replays the original chunks and preserves their is_last flags. It clears start when replaying subscriptions so the client avoids requesting historical data again. No new dependencies.

Fixes #143

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

Both mock-gateway regression cases (subscribe and unsubscribe) failed on 0.90.0 and passed w/ the fix on Linux. The tests run w/o a live API key. The reconnect test module skips on Windows.

python -m pytest -q tests/test_live_client_reconnect.py -k preserves_request_batch_boundaries

Checklist

  • I have added tests that prove the fix is effective
  • git diff --check passes

Declaration

I confirm this contribution is made under an Apache 2.0 license and that I have the authority necessary to make this contribution on behalf of its copyright owner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Live reconnect marks every chunk of a batched request as final

1 participant