🎨 Support setting automatic sync interval https://github.com/siyuan-note/siyuan/issues/13448

This commit is contained in:
Daniel 2024-12-14 12:02:14 +08:00
parent 152fa6e6e0
commit 45a6f7e29d
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
18 changed files with 100 additions and 12 deletions

View file

@ -389,6 +389,20 @@ func SetSyncEnable(b bool) {
return
}
func SetSyncInterval(interval int) {
if 30 > interval {
interval = 30
}
if 43200 < interval {
interval = 43200
}
Conf.Sync.Interval = interval
Conf.Save()
planSyncAfter(time.Duration(interval) * time.Second)
return
}
func SetSyncPerception(b bool) {
if util.ContainerDocker == util.Container {
b = false
@ -641,7 +655,7 @@ func getSyncIgnoreLines() (ret []string) {
func IncSync() {
syncSameCount.Store(0)
planSyncAfter(30 * time.Second)
planSyncAfter(time.Duration(Conf.Sync.Interval) * time.Second)
}
func planSyncAfter(d time.Duration) {