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()
|
f.pull()
|
||||||
|
|
||||||
case <-f.pullFailTimer.C:
|
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:
|
case <-initialCompleted:
|
||||||
// Initial scan has completed, we should do a pull
|
// Initial scan has completed, we should do a pull
|
||||||
|
@ -276,7 +279,7 @@ func (f *folder) getHealthErrorWithoutIgnores() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *folder) pull() bool {
|
func (f *folder) pull() (success bool) {
|
||||||
f.pullFailTimer.Stop()
|
f.pullFailTimer.Stop()
|
||||||
select {
|
select {
|
||||||
case <-f.pullFailTimer.C:
|
case <-f.pullFailTimer.C:
|
||||||
|
@ -290,6 +293,13 @@ func (f *folder) pull() bool {
|
||||||
return true
|
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.
|
// If there is nothing to do, don't even enter sync-waiting state.
|
||||||
abort := true
|
abort := true
|
||||||
snap := f.fset.Snapshot()
|
snap := f.fset.Snapshot()
|
||||||
|
@ -312,24 +322,16 @@ func (f *folder) pull() bool {
|
||||||
|
|
||||||
startTime := time.Now()
|
startTime := time.Now()
|
||||||
|
|
||||||
success := f.puller.pull()
|
success = f.puller.pull()
|
||||||
|
|
||||||
basePause := f.pullBasePause()
|
|
||||||
|
|
||||||
if success {
|
if success {
|
||||||
// We're good. Don't schedule another pull and reset
|
|
||||||
// the pause interval.
|
|
||||||
f.pullPause = basePause
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pulling failed, try again later.
|
// Pulling failed, try again later.
|
||||||
delay := f.pullPause + time.Since(startTime)
|
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)
|
f.pullFailTimer.Reset(delay)
|
||||||
if f.pullPause < 60*basePause {
|
|
||||||
f.pullPause *= 2
|
|
||||||
}
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue