From 3d781220530e4acc5a9279122ab3923e4d23416c Mon Sep 17 00:00:00 2001 From: Ingo Oppermann Date: Tue, 16 Jul 2024 08:13:15 +0200 Subject: [PATCH] Fix crash when updating unavailable node --- cluster/node/core.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/cluster/node/core.go b/cluster/node/core.go index 5f158805..3b57f913 100644 --- a/cluster/node/core.go +++ b/cluster/node/core.go @@ -66,19 +66,21 @@ func (n *Core) SetEssentials(address string, config *config.Config) { n.lock.Lock() defer n.lock.Unlock() - if address != n.address { + if n.address != address { n.address = address n.client = nil // force reconnet } - if n.config == nil && config != nil { - n.config = config - n.client = nil // force reconnect - } + if config != nil { + if n.config == nil { + n.config = config + n.client = nil // force reconnect + } - if n.config.UpdatedAt != config.UpdatedAt { - n.config = config - n.client = nil // force reconnect + if n.config != nil && n.config.UpdatedAt != config.UpdatedAt { + n.config = config + n.client = nil // force reconnect + } } }