samples-typescript icon indicating copy to clipboard operation
samples-typescript copied to clipboard

Background heartbeating sample

Open mnichols opened this issue 10 months ago • 2 comments

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 avatar Mar 19 '25 19:03 mnichols

@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.

mnichols avatar May 13 '25 16:05 mnichols

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.

mjameswh avatar May 13 '25 16:05 mjameswh