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

[ADDED] Setting heartbeats in Fetch and FetchBatch in legacy API #1402

Merged
merged 2 commits into from
Sep 16, 2023

Conversation

piotrpio
Copy link
Collaborator

No description provided.

Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
Copy link
Member

@Jarema Jarema left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One request change.

@@ -2813,15 +2831,36 @@ func (sub *Subscription) Fetch(batch int, opts ...PullOpt) ([]*Msg, error) {
nr.Expires = expires
nr.NoWait = noWait
nr.MaxBytes = o.maxBytes
if 2*o.hb < expires {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If heartbeat is larger than expires/2, server will return first message as error:

400, Some(\"Bad Request - heartbeat value too large\")") }

So I would rather not have that logic here and allow server to throw that error normally?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this is required because Fetch can send more than 1 pull request, and even though for the first request the value may be valid, when the second one is sent we don't really know up front what the expiry will be - so if we depend on the server we will return an error when we shouldn't.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. Maybe return error when users tries to send fetch with bad hb?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@Jarema Jarema left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@piotrpio piotrpio merged commit 79f092a into main Sep 16, 2023
1 of 2 checks passed
@piotrpio piotrpio deleted the legacy-fetch-hb branch September 16, 2023 06:36
@piotrpio piotrpio mentioned this pull request Sep 20, 2023
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.

None yet

2 participants