Skip to content

Cancel pending heartbeat when activity completes #2526

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Quinn-With-Two-Ns
Copy link
Contributor

Cancel pending heartbeat when activity completes. This prevents the heartbeat from holding up worker shutdown and prevents heartbeating an already completed activity

closes: #1256

@Quinn-With-Two-Ns Quinn-With-Two-Ns marked this pull request as ready for review May 15, 2025 21:44
@Quinn-With-Two-Ns Quinn-With-Two-Ns requested a review from a team as a code owner May 15, 2025 21:44
Comment on lines +133 to +135
// if the activity is not completed, we need to cancel the heartbeat
// to avoid sending it after the activity is completed
context.cancelOutstandingHeartbeat();
Copy link
Member

Choose a reason for hiding this comment

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

Can you clarify this a bit? So except for async-activity-completion, this is going to prevent a pending heartbeat from being recorded? Is there somewhere else in Java where the last heartbeat of a failing activity is guaranteed to be sent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there somewhere else in Java where the last heartbeat of a failing activity is guaranteed to be sent?

Yes, we send the last heartbeat value as part of the activity failure.

Copy link
Member

Choose a reason for hiding this comment

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

So to double-extra confirm, this is guaranteed only for non-async-activity-complete situations where the task is already complete, and therefore this logic will never cause a lost heartbeat at the end?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we never loose a heartbeat since we always send the last hearbeat as part of activity failure

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.

Last cached activity heartbeat should be discarded or drained with activity completion or worker shutdown
2 participants