load prev state
All checks were successful
Build and Publish / BuildAndDeployAmd64 (push) Successful in 42s
Build and Publish / BuildAndDeployArm64 (push) Successful in 4m20s

This commit is contained in:
2025-12-03 22:30:13 +01:00
parent 401286c56a
commit 3af837d824
2 changed files with 6 additions and 1 deletions

View File

@@ -257,7 +257,7 @@ func (a *CheckoutPoolServer) getGrainFromKlarnaOrder(ctx context.Context, order
if !ok {
return nil, fmt.Errorf("invalid cart id in order reference: %s", order.MerchantReference1)
}
grain, err := a.Get(ctx, uint64(cartId))
grain, err := a.getAnywhere(ctx, uint64(cartId))
if err != nil {
return nil, fmt.Errorf("failed to get cart grain: %w", err)
}

View File

@@ -79,6 +79,11 @@ func main() {
grainSpawns.Inc()
ret := checkout.NewCheckoutGrain(id, 0, 0, time.Now(), nil) // version to be set later
// Load persisted events/state for this checkout if present
if err := diskStorage.LoadEvents(ctx, id, ret); err != nil {
// Return the grain along with error (e.g., not found) so callers can decide
return ret, err
}
return ret, nil
},
Destroy: func(grain actor.Grain[checkout.CheckoutGrain]) error {