Skip to content

Commit d58423c

Browse files
committed
fix: fixed fakeProgress activity heartbeat
1 parent 022d78f commit d58423c

2 files changed

Lines changed: 2 additions & 169 deletions

File tree

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 when 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) {

package-lock.json

Lines changed: 0 additions & 168 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)