cleanup
This commit is contained in:
@@ -110,6 +110,9 @@ func main() {
|
||||
actor.NewMutation(InitializeCheckout, func() *messages.InitializeCheckout {
|
||||
return &messages.InitializeCheckout{}
|
||||
}),
|
||||
actor.NewMutation(OrderCreated, func() *messages.OrderCreated {
|
||||
return &messages.OrderCreated{}
|
||||
}),
|
||||
actor.NewMutation(RemoveDelivery, func() *messages.RemoveDelivery {
|
||||
return &messages.RemoveDelivery{}
|
||||
}),
|
||||
@@ -119,6 +122,9 @@ func main() {
|
||||
actor.NewMutation(SetPickupPoint, func() *messages.SetPickupPoint {
|
||||
return &messages.SetPickupPoint{}
|
||||
}),
|
||||
actor.NewMutation(ClearCart, func() *messages.ClearCartRequest {
|
||||
return &messages.ClearCartRequest{}
|
||||
}),
|
||||
)
|
||||
diskStorage := actor.NewDiskStorage[CartGrain]("data", reg)
|
||||
poolConfig := actor.GrainPoolConfig[CartGrain]{
|
||||
@@ -372,7 +378,7 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
err = triggerOrderCompleted(err, syncedServer, order)
|
||||
err = triggerOrderCompleted(syncedServer, order)
|
||||
if err != nil {
|
||||
log.Printf("Error processing cart message: %v\n", err)
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
@@ -409,7 +415,7 @@ func main() {
|
||||
|
||||
}
|
||||
|
||||
func triggerOrderCompleted(err error, syncedServer *PoolServer, order *CheckoutOrder) error {
|
||||
func triggerOrderCompleted(syncedServer *PoolServer, order *CheckoutOrder) error {
|
||||
mutation := &messages.OrderCreated{
|
||||
OrderId: order.ID,
|
||||
Status: order.Status,
|
||||
@@ -418,10 +424,8 @@ func triggerOrderCompleted(err error, syncedServer *PoolServer, order *CheckoutO
|
||||
if !ok {
|
||||
return fmt.Errorf("invalid cart id in order reference: %s", order.MerchantReference1)
|
||||
}
|
||||
_, applyErr := syncedServer.pool.Apply(uint64(cid), mutation)
|
||||
if applyErr == nil {
|
||||
_ = AppendCartEvent(cid, mutation)
|
||||
}
|
||||
_, applyErr := syncedServer.Apply(uint64(cid), mutation)
|
||||
|
||||
return applyErr
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user