only after mutations
All checks were successful
Build and Publish / Metadata (push) Successful in 10s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 1m15s
Build and Publish / BuildAndDeployArm64 (push) Successful in 4m31s

This commit is contained in:
matst80
2025-10-20 21:09:45 +02:00
parent 9ecd91c163
commit 7eb000fd17
2 changed files with 19 additions and 15 deletions

View File

@@ -117,14 +117,16 @@ func main() {
promotionService := promotions.NewPromotionService(nil)
reg := cart.NewCartMultationRegistry()
reg.RegisterProcessor(actor.NewMutationProcessor(func(g *cart.CartGrain) error {
reg.RegisterProcessor(
actor.NewMutationProcessor(func(g *cart.CartGrain) error {
ctx := promotions.NewContextFromCart(g)
_, actions := promotionService.EvaluateAll(promotionData.State.Promotions, ctx)
for _, action := range actions {
log.Printf("apply: %V", action)
}
return nil
}), actor.NewMutationProcessor(func(g *cart.CartGrain) error {
}),
actor.NewMutationProcessor(func(g *cart.CartGrain) error {
g.UpdateTotals()
return nil
}))

View File

@@ -225,12 +225,14 @@ func (r *ProtoMutationRegistry) Apply(grain any, msg ...proto.Message) ([]ApplyR
results = append(results, ApplyResult{Error: err, Type: rt.Name(), Mutation: m})
}
if len(results) > 0 {
for _, processor := range r.processors {
err := processor.Process(grain)
if err != nil {
return results, err
}
}
}
return results, nil
}