fix(model): avoid flashing "Sync Waiting" unnecessarily (#10181)
This commit is contained in:
+6
-2
@@ -188,8 +188,12 @@ func (f *folder) Serve(ctx context.Context) error {
|
|||||||
case <-f.pullScheduled:
|
case <-f.pullScheduled:
|
||||||
if f.PullerDelayS > 0 {
|
if f.PullerDelayS > 0 {
|
||||||
// Wait for incoming updates to settle before doing the
|
// Wait for incoming updates to settle before doing the
|
||||||
// actual pull
|
// actual pull. Only set the state to SyncWaiting if we have
|
||||||
f.setState(FolderSyncWaiting)
|
// reason to believe there is something to sync, to avoid
|
||||||
|
// unnecessary flashing in the GUI.
|
||||||
|
if needCount, err := f.db.CountNeed(f.folderID, protocol.LocalDeviceID); err == nil && needCount.TotalItems() > 0 {
|
||||||
|
f.setState(FolderSyncWaiting)
|
||||||
|
}
|
||||||
pullTimer.Reset(time.Duration(float64(time.Second) * f.PullerDelayS))
|
pullTimer.Reset(time.Duration(float64(time.Second) * f.PullerDelayS))
|
||||||
} else {
|
} else {
|
||||||
_, err = f.pull()
|
_, err = f.pull()
|
||||||
|
|||||||
Reference in New Issue
Block a user