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

Rework idle heartbeat for pull consumers #1046

Merged
merged 1 commit into from
Jul 21, 2023
Merged

Conversation

Jarema
Copy link
Member

@Jarema Jarema commented Jul 21, 2023

Signed-off-by: Tomasz Pietrek tomasz@nats.io

@Jarema Jarema requested a review from caspervonb July 21, 2023 08:48
trace!("setting hearbeats");
let timeout = self.batch_config.idle_heartbeat.saturating_mul(2);
self.heartbeat_timeout.get_or_insert_with(|| {
Box::pin(tokio::time::timeout(timeout, futures::future::pending()))
Copy link
Contributor

Choose a reason for hiding this comment

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

This could have been done with Sleep

Copy link
Member Author

Choose a reason for hiding this comment

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

oh, right. I took it over from different approach I had before. Nice nit. Thx.

Signed-off-by: Tomasz Pietrek <tomasz@nats.io>

--amend

Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
@Jarema Jarema force-pushed the rework-heartbeats-for-pull branch from ff5a74f to 685337b Compare July 21, 2023 13:45
Copy link
Collaborator

@caspervonb caspervonb left a comment

Choose a reason for hiding this comment

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

tiny nit, lgtm.

terminated: bool,
heartbeat_timeout: Option<Pin<Box<tokio::time::Sleep>>>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: heartbeat_sleep

@Jarema Jarema merged commit 0534719 into main Jul 21, 2023
13 checks passed
@Jarema Jarema deleted the rework-heartbeats-for-pull branch July 21, 2023 16:28
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

3 participants