Skip to content

Commit

Permalink
Fix grid leader errors (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajroetker committed Jul 6, 2021
1 parent c343163 commit 885fd25
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,11 @@ func (s *Server) startActorC(c context.Context, start *ActorStart) error {
timeout, cancel := context.WithTimeout(c, s.cfg.Timeout)
defer cancel()
if err := s.registry.Register(timeout, nsName); err != nil {
s.deregisterActor(nsName)
// Grid tries to start up leaders continuously so we need to ignore calling deregister
// otherwise we will deregister a leader out from under itself starting multiple leaders
if !(start.Type == "leader" && strings.Contains(err.Error(), registry.ErrAlreadyRegistered.Error())) {
s.deregisterActor(nsName)
}
return fmt.Errorf("registering actor %q: %w", nsName, err)
}

Expand Down

0 comments on commit 885fd25

Please sign in to comment.