Skip to content

Commit

Permalink
Fix awakeable holder race
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkleeman committed Nov 7, 2024
1 parent 1a4815b commit 2733774
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test-services/awakeableholder.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ func init() {
})).
Handler("hasAwakeable", restate.NewObjectHandler(
func(ctx restate.ObjectContext, _ restate.Void) (bool, error) {
_, err := restate.Get[string](ctx, ID_KEY)
id, err := restate.Get[string](ctx, ID_KEY)
if err != nil {
return false, err
}
return err == nil, nil
return id != "", nil
})).
Handler("unlock", restate.NewObjectHandler(
func(ctx restate.ObjectContext, payload string) (restate.Void, error) {
Expand All @@ -34,6 +34,7 @@ func init() {
return restate.Void{}, restate.TerminalError(fmt.Errorf("No awakeable registered"), 404)
}
restate.ResolveAwakeable(ctx, id, payload)
restate.Clear(ctx, ID_KEY)
return restate.Void{}, nil
})))
}

0 comments on commit 2733774

Please sign in to comment.