From cea31d664c6406573bb966d3dfa70c5f8ad8d8b8 Mon Sep 17 00:00:00 2001 From: Ivan Kripakov Date: Wed, 20 Dec 2023 17:32:59 +0400 Subject: [PATCH] don't remove dkron server node if id matches --- Makefile | 2 +- dkron/leader.go | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 8f352faa9..dbd3f9724 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ release: -e DOCKER_USERNAME \ -e DOCKER_PASSWORD \ -e DOCKER_REGISTRY \ - -e GORELEASER_CURRENT_TAG=v3.2.7-M4 \ + -e GORELEASER_CURRENT_TAG=v3.2.7-M5 \ -v /var/run/docker.sock:/var/run/docker.sock \ goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \ release --rm-dist --skip-validate --timeout=1h diff --git a/dkron/leader.go b/dkron/leader.go index 27d169f57..1d3119517 100644 --- a/dkron/leader.go +++ b/dkron/leader.go @@ -285,17 +285,12 @@ func (a *Agent) addRaftPeer(m serf.Member, parts *ServerParts) error { if server.Address == raft.ServerAddress(addr) && server.ID == raft.ServerID(parts.ID) { return nil } - future := a.raft.RemoveServer(server.ID, 0, 0) if server.Address == raft.ServerAddress(addr) { + future := a.raft.RemoveServer(server.ID, 0, 0) if err := future.Error(); err != nil { return fmt.Errorf("error removing server with duplicate address %q: %s", server.Address, err) } a.logger.WithField("server", server.Address).Info("dkron: removed server with duplicate address") - } else { - if err := future.Error(); err != nil { - return fmt.Errorf("error removing server with duplicate ID %q: %s", server.ID, err) - } - a.logger.WithField("server", server.ID).Info("dkron: removed server with duplicate ID") } } }