mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-05 16:12:20 +00:00
lib/model: Don't increase pull pause on triggered pull (#6690)
This commit is contained in:
parent
04ff890263
commit
ed6bfc5417
@ -148,7 +148,10 @@ func (f *folder) serve(ctx context.Context) {
|
||||
f.pull()
|
||||
|
||||
case <-f.pullFailTimer.C:
|
||||
f.pull()
|
||||
if !f.pull() && f.pullPause < 60*f.pullBasePause() {
|
||||
// Back off from retrying to pull
|
||||
f.pullPause *= 2
|
||||
}
|
||||
|
||||
case <-initialCompleted:
|
||||
// Initial scan has completed, we should do a pull
|
||||
@ -276,7 +279,7 @@ func (f *folder) getHealthErrorWithoutIgnores() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *folder) pull() bool {
|
||||
func (f *folder) pull() (success bool) {
|
||||
f.pullFailTimer.Stop()
|
||||
select {
|
||||
case <-f.pullFailTimer.C:
|
||||
@ -290,6 +293,13 @@ func (f *folder) pull() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if success {
|
||||
// We're good, reset the pause interval.
|
||||
f.pullPause = f.pullBasePause()
|
||||
}
|
||||
}()
|
||||
|
||||
// If there is nothing to do, don't even enter sync-waiting state.
|
||||
abort := true
|
||||
snap := f.fset.Snapshot()
|
||||
@ -312,24 +322,16 @@ func (f *folder) pull() bool {
|
||||
|
||||
startTime := time.Now()
|
||||
|
||||
success := f.puller.pull()
|
||||
|
||||
basePause := f.pullBasePause()
|
||||
success = f.puller.pull()
|
||||
|
||||
if success {
|
||||
// We're good. Don't schedule another pull and reset
|
||||
// the pause interval.
|
||||
f.pullPause = basePause
|
||||
return true
|
||||
}
|
||||
|
||||
// Pulling failed, try again later.
|
||||
delay := f.pullPause + time.Since(startTime)
|
||||
l.Infof("Folder %v isn't making sync progress - retrying in %v.", f.Description(), delay)
|
||||
l.Infof("Folder %v isn't making sync progress - retrying in %v.", f.Description(), delay.Truncate(time.Second))
|
||||
f.pullFailTimer.Reset(delay)
|
||||
if f.pullPause < 60*basePause {
|
||||
f.pullPause *= 2
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user