Skip to content

Commit 1509737

Browse files
committed
fix: fixed heatbeating in fakeProgress activity
1 parent 022d78f commit 1509737

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

activities-cancellation-heartbeating/src/activities.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ export async function fakeProgress(sleepIntervalMs = 1000): Promise<void> {
77
const startingPoint = activityInfo().heartbeatDetails || 1;
88
log.info('Starting activity at progress', { startingPoint });
99
for (let progress = startingPoint; progress <= 100; ++progress) {
10+
// heartbeat immediately after entering loop to retry activity from last failed progress
11+
heartbeat(progress);
1012
// simple utility to sleep in activity for given interval or throw if Activity is cancelled
1113
// don't confuse with Workflow.sleep which is only used in Workflow functions!
1214
log.info('Progress', { progress });
1315
await sleep(sleepIntervalMs);
14-
heartbeat(progress);
1516
}
1617
} catch (err) {
1718
if (err instanceof CancelledFailure) {

0 commit comments

Comments
 (0)