mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 14:50:56 +00:00
Increase reconnect delay towards max
This commit is contained in:
parent
5fa8f8e50c
commit
21b699826d
@ -612,6 +612,7 @@ func listenConnect(myID string, m *model.Model, tlsCfg *tls.Config) {
|
||||
|
||||
// Connect
|
||||
go func() {
|
||||
var delay time.Duration = 1 * time.Second
|
||||
for {
|
||||
nextNode:
|
||||
for _, nodeCfg := range cfg.Nodes {
|
||||
@ -662,7 +663,11 @@ func listenConnect(myID string, m *model.Model, tlsCfg *tls.Config) {
|
||||
}
|
||||
}
|
||||
|
||||
time.Sleep(time.Duration(cfg.Options.ReconnectIntervalS) * time.Second)
|
||||
time.Sleep(delay)
|
||||
delay *= 2
|
||||
if maxD := time.Duration(cfg.Options.ReconnectIntervalS) * time.Second; delay > maxD {
|
||||
delay = maxD
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user