Skip to content

Commit

Permalink
fix(examples): add artificial sleeps to workflow example
Browse files Browse the repository at this point in the history
fixes the pause/resume test

Signed-off-by: mikeee <[email protected]>
  • Loading branch information
mikeee committed Jan 29, 2025
1 parent dcf1bd6 commit 26a2029
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions examples/workflow/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ func main() {
log.Fatalf("failed to pause workflow: %v", err)
}

respFetch, err := wfClient.FetchWorkflowMetadata(ctx, instanceID, workflow.WithFetchPayloads(true))
time.Sleep(time.Second) // allow workflow to pause

respFetch, err := wfClient.FetchWorkflowMetadata(context.TODO(), instanceID, workflow.WithFetchPayloads(true))
if err != nil {
log.Fatalf("failed to fetch workflow: %v", err)
}
Expand All @@ -93,7 +95,9 @@ func main() {
log.Fatalf("failed to resume workflow: %v", err)
}

respFetch, err = wfClient.FetchWorkflowMetadata(ctx, instanceID, workflow.WithFetchPayloads(true))
time.Sleep(time.Second) // allow workflow to resume

respFetch, err = wfClient.FetchWorkflowMetadata(context.TODO(), instanceID, workflow.WithFetchPayloads(true))
if err != nil {
log.Fatalf("failed to get workflow: %v", err)
}
Expand Down Expand Up @@ -141,7 +145,7 @@ func main() {
log.Fatalf("failed to purge workflow: %v", err)
}

respFetch, err = wfClient.FetchWorkflowMetadata(ctx, instanceID, workflow.WithFetchPayloads(true))
respFetch, err = wfClient.FetchWorkflowMetadata(context.TODO(), instanceID, workflow.WithFetchPayloads(true))
if err == nil || respFetch != nil {
log.Fatalf("failed to purge workflow: %v", err)
}
Expand Down

0 comments on commit 26a2029

Please sign in to comment.