Skip to content

Background heartbeating sample #416

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 2 commits into
base: main
Choose a base branch
from
Open

Background heartbeating sample #416

wants to merge 2 commits into from

Conversation

mnichols
Copy link
Contributor

This shows (and tests) how to have a heartbeat executing inside a loop while performing a long running operation inside an Activity.
This needs to support cancellation as well.

What was changed

Extended the heartbeat demonstration with a realistic long-running activity impl that needs to kick of both a periodic heartbeat and a long-running, blocking process inside an Activity.
For example, writing to a file might take a loooong time but I want to ping the Temporal service in the background while my sync file operation is doing it's thing.

Why?

It should make clearer how to get these concurrent things working together.

Checklist

  1. How was this tested: mocha unit tests. Also verified cancellation works like I'd expect.

  2. Any docs updates needed? Not really

@mnichols
Copy link
Contributor Author

@mjameswh is there any feedback on this or should I close this and put this in my own repo showing common patterns?
The python samples has an auto-heartbeater sample so I thought this might be a compliment to that.

@mjameswh
Copy link
Contributor

May 13, 2025

Sorry Mike, I have been very busy on other things. Please leave it open here, it is definitely a good fit for this repo. I will try to review sooner than later.

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.

2 participants