mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-11 02:36:17 +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
|
// Connect
|
||||||
go func() {
|
go func() {
|
||||||
|
var delay time.Duration = 1 * time.Second
|
||||||
for {
|
for {
|
||||||
nextNode:
|
nextNode:
|
||||||
for _, nodeCfg := range cfg.Nodes {
|
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