only after mutations
This commit is contained in:
@@ -117,17 +117,19 @@ func main() {
|
||||
promotionService := promotions.NewPromotionService(nil)
|
||||
|
||||
reg := cart.NewCartMultationRegistry()
|
||||
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 {
|
||||
g.UpdateTotals()
|
||||
return nil
|
||||
}))
|
||||
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 {
|
||||
g.UpdateTotals()
|
||||
return nil
|
||||
}))
|
||||
diskStorage := actor.NewDiskStorage[cart.CartGrain]("data", reg)
|
||||
poolConfig := actor.GrainPoolConfig[cart.CartGrain]{
|
||||
MutationRegistry: reg,
|
||||
|
||||
Reference in New Issue
Block a user