mirror of
https://github.com/datarhei/core.git
synced 2025-10-19 06:14:45 +08:00
Fix crash when updating unavailable node
This commit is contained in:
@@ -66,21 +66,23 @@ 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 {
|
||||
if config != nil {
|
||||
if n.config == nil {
|
||||
n.config = config
|
||||
n.client = nil // force reconnect
|
||||
}
|
||||
|
||||
if n.config.UpdatedAt != config.UpdatedAt {
|
||||
if n.config != nil && n.config.UpdatedAt != config.UpdatedAt {
|
||||
n.config = config
|
||||
n.client = nil // force reconnect
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (n *Core) reconnect(ctx context.Context, interval time.Duration) {
|
||||
ticker := time.NewTicker(interval)
|
||||
|
Reference in New Issue
Block a user