From 30b98f93ce482e0ceee5ebc4d4900a10de98d40c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20T=C3=B6rnberg?= Date: Mon, 13 Oct 2025 20:01:41 +0200 Subject: [PATCH] get correct type --- pkg/actor/mutation_registry.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pkg/actor/mutation_registry.go b/pkg/actor/mutation_registry.go index 9fdfa88..37130bf 100644 --- a/pkg/actor/mutation_registry.go +++ b/pkg/actor/mutation_registry.go @@ -153,15 +153,14 @@ func (r *ProtoMutationRegistry) Apply(grain any, msg ...proto.Message) error { 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 { + 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 { return err }