Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[client]: simplify subscription API #1291

Closed
Tracked by #1292
niklasad1 opened this issue Feb 12, 2024 · 0 comments · Fixed by #1320
Closed
Tracked by #1292

[client]: simplify subscription API #1291

niklasad1 opened this issue Feb 12, 2024 · 0 comments · Fixed by #1320
Assignees

Comments

@niklasad1
Copy link
Member

niklasad1 commented Feb 12, 2024

The "current" subscription API for the client doesn't expose how a subscription was closed.

The subscription can return :
- None: The connection was closed
- None: The subscription could not keep up with server a.k.a slow-receiver problem.
- Err(e): Failed to parse the subscription item as T

Thus, we should modify the API to do the following:

  • None: The connection was closed
  • Err(SubscriptionError::Lagged) - The subscription lagged too far behind i.e, could not keep up with the server. The error itself indicates how many messages that were replace/missed
  • Err(Subscription::Parse) - Failed to decode item as T

Some notes about SubscriptionError::Lagged

When this occurs it's up the user the decide whether that is okay to loose a few messages to continue, re-subscribe or drain/clear the buffer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant