Complete refactor to new grpc control plane and only http proxy for carts #4
@@ -153,15 +153,14 @@ func (r *ProtoMutationRegistry) Apply(grain any, msg ...proto.Message) error {
|
|||||||
return fmt.Errorf("nil mutation message")
|
return fmt.Errorf("nil mutation message")
|
||||||
}
|
}
|
||||||
|
|
||||||
rt := indirectType(reflect.TypeOf(msg))
|
|
||||||
r.mutationRegistryMu.RLock()
|
|
||||||
entry, ok := r.mutationRegistry[rt]
|
|
||||||
r.mutationRegistryMu.RUnlock()
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
return ErrMutationNotRegistered
|
|
||||||
}
|
|
||||||
for _, m := range msg {
|
for _, m := range msg {
|
||||||
|
rt := indirectType(reflect.TypeOf(msg))
|
||||||
|
r.mutationRegistryMu.RLock()
|
||||||
|
entry, ok := r.mutationRegistry[rt]
|
||||||
|
r.mutationRegistryMu.RUnlock()
|
||||||
|
if !ok {
|
||||||
|
return ErrMutationNotRegistered
|
||||||
|
}
|
||||||
if err := entry.Handle(grain, m); err != nil {
|
if err := entry.Handle(grain, m); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user