-
Notifications
You must be signed in to change notification settings - Fork 664
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
Conversation
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
06ef32d
to
a7cd4ea
Compare
No description provided.