temporalio / temporalio/samples-typescript
fix heartbeating in fakeProgress activity
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 465
- Forks
- 148
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 11
Description
What are you really trying to do?
When heartbeating after some task (that may be writing data in DB) in fakeProgress activity when there is a failure the activity retries from a previous successful progress which may lead to data inconsistency(when dealing with data insertion in DB).
Describe the bug
With the existing heartbeat in the fakeProgress activity it whem retried it have to perform an extra iteration, which when the heartbeat is sent immediately after entering the loop saves this extra iteration. When some data insertion is a step in this loop, this may lead to data duplication.
Minimal Reproduction
I have identified this issue on my personal project and this is quite self explanatory.
Example case:
when progress = 4
heartbeat details -> 3 (previous progress)
if activity fails at this progress it will be retried from the point where progress == 3, and the iteration with progress == 3 is a successful iteration which should not be the retrying point.
PR - https://github.com/temporalio/samples-typescript/pull/363
Environment/Versions
temporal sdk version - 1.9.3
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the fakeProgress activity and the minimal reproduction described in the issue, focusing on when heartbeat progress is recorded relative to each loop iteration. Verify the progress value saved for a heartbeat after progress 4 and test a retry after failure; done means a retry does not repeat the already successful iteration or duplicate inserted data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100