Skip to content

Commit

Permalink
Fix await condition
Browse files Browse the repository at this point in the history
  • Loading branch information
yuandrew committed Feb 5, 2025
1 parent eee06ce commit 9467050
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion shoppingcart/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,14 @@ func CartWorkflow(ctx workflow.Context, cart *CartState) error {

signalChan := workflow.GetSignalChannel(ctx, "checkout")

err := workflow.Await(ctx, func() bool { return workflow.GetInfo(ctx).GetContinueAsNewSuggested() || signalChan.Receive(ctx, nil) })
err := workflow.Await(ctx, func() bool {
if workflow.GetInfo(ctx).GetContinueAsNewSuggested() {
return true
}
signalChan.Receive(ctx, nil)

return true
})
if err != nil {
return err
}
Expand Down

0 comments on commit 9467050

Please sign in to comment.