mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 00:38:49 +01:00
🎨 云端同步时自动创建数据快照
This commit is contained in:
parent
1679df6209
commit
3538a01d3b
3 changed files with 18 additions and 12 deletions
|
|
@ -40,7 +40,7 @@ require (
|
|||
github.com/patrickmn/go-cache v2.1.0+incompatible
|
||||
github.com/qiniu/go-sdk/v7 v7.13.0
|
||||
github.com/radovskyb/watcher v1.0.7
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220616034124-40a031c36730
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220616050739-e25262132c10
|
||||
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676
|
||||
github.com/siyuan-note/filelock v0.0.0-20220615164210-064676f342aa
|
||||
github.com/vmihailenco/msgpack/v5 v5.3.5
|
||||
|
|
@ -109,7 +109,8 @@ require (
|
|||
|
||||
replace github.com/mattn/go-sqlite3 => github.com/88250/go-sqlite3 v1.14.13-0.20220412041952-88c3aaa8595e
|
||||
|
||||
//replace github.com/siyuan-note/dejavu => D:\88250\dejavu
|
||||
replace github.com/siyuan-note/dejavu => D:\88250\dejavu
|
||||
|
||||
//replace github.com/88250/lute => D:\gogogo\src\github.com\88250\lute
|
||||
//replace github.com/88250/enumfonts => D:\88250\enumfonts
|
||||
//replace github.com/88250/pdfcpu => D:\88250\pdfcpu
|
||||
|
|
|
|||
|
|
@ -419,10 +419,6 @@ github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJ
|
|||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
|
||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220615164826-201b6516adf3 h1:pWPKLb4bpv5Cj8jErsuVKAvXqmudz+0XVfVWZjVxGJc=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220615164826-201b6516adf3/go.mod h1:0XMLF+6gtwqr3ZJTk3nZmNbmQ4xNdaoP9RXKDR2ggkw=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220616034124-40a031c36730 h1:leFyjVzzx8/6upv6ciFl3tVZtTkXGi+71NESaMeuC30=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220616034124-40a031c36730/go.mod h1:0XMLF+6gtwqr3ZJTk3nZmNbmQ4xNdaoP9RXKDR2ggkw=
|
||||
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676 h1:QB9TjJQFhXhZ6dAtPpY02DlzHAQm1C+WqZq6OadG8mI=
|
||||
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=
|
||||
github.com/siyuan-note/filelock v0.0.0-20220615164210-064676f342aa h1:6bXZdsdA5EU1NUChdFV4EwH8nvYUis0H1TxwgadLM38=
|
||||
|
|
@ -657,8 +653,6 @@ golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211020174200-9d6173849985/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220614162138-6c1b26c55098 h1:PgOr27OhUx2IRqGJ2RxAWI4dJQ7bi9cSrB82uzFzfUA=
|
||||
golang.org/x/sys v0.0.0-20220614162138-6c1b26c55098/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c h1:aFV+BgZ4svzjfabn8ERpuB4JI4N6/rdy1iusx77G3oU=
|
||||
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import (
|
|||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
|
|
@ -214,13 +215,23 @@ func indexRepoBeforeCloudSync() {
|
|||
}
|
||||
|
||||
start := time.Now()
|
||||
_, err = repo.Index("[Auto] Cloud sync", nil, nil)
|
||||
latest, err := repo.Latest()
|
||||
index, err := repo.Index("[Auto] Cloud sync", nil, nil)
|
||||
if nil != err {
|
||||
util.LogErrorf("index repo before cloud sync failed: %s", err)
|
||||
return
|
||||
}
|
||||
elapsed := time.Since(start).Milliseconds()
|
||||
if 7000 < elapsed {
|
||||
util.LogWarnf("index repo before cloud sync elapsed [%dms]", elapsed)
|
||||
elapsed := time.Since(start)
|
||||
if nil != latest && latest.ID != index.ID {
|
||||
// 对新创建的快照需要更新备注,加入耗时统计
|
||||
index.Memo = fmt.Sprintf("[Auto] Cloud sync, completed in [%.2fs]", elapsed.Seconds())
|
||||
err = repo.PutIndex(index)
|
||||
if nil != err {
|
||||
util.LogErrorf("put index into repo before cloud sync failed: %s", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
if 7000 < elapsed.Milliseconds() {
|
||||
util.LogWarnf("index repo before cloud sync elapsed [%dms]", elapsed.Milliseconds())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue