lib/model: Properly schedule pull on reconnect (fixes #4504)

We need to reset prevSeq so that we force a full check when someone
reconnects - the sequence number may not have changed due to the
reconnect. (This is a regression; we did this before f6ea2a7.)

Also add an optimization: we schedule a pull after scanning, but there
is no need to do so if no changes were detected. This matters now
because the scheduled pull actually traverses the database which is
expensive.

This, however, makes the pull not happen on initial scan if there were
no changes during the initial scan. Compensate by always scheduling a
pull after initial scan in the rwfolder itself.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4508
LGTM: imsodin, AudriusButkevicius
This commit is contained in:
Jakob Borg
2017-11-17 12:11:45 +00:00
committed by Audrius Butkevicius
parent ee5d0dd43f
commit 5f4ed66aa1
5 changed files with 59 additions and 101 deletions

View File

@@ -20,8 +20,8 @@ import (
)
const (
longTimeLimit = 5 * time.Minute
shortTimeLimit = 45 * time.Second
longTimeLimit = 1 * time.Minute
shortTimeLimit = 25 * time.Second
s12Folder = `¯\_(ツ)_/¯ Räksmörgås 动作 Адрес` // This was renamed to ensure arbitrary folder IDs are fine.
)