From d92f805e31fa3797092ed75bf1a3a8b396e2803a Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 19 Jul 2022 10:43:27 +0800 Subject: [PATCH 1/2] =?UTF-8?q?:art:=20=E5=90=8C=E6=AD=A5=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E5=90=8E=E5=A6=82=E6=9E=9C=2020%=20=E7=9A=84=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=AD=98=E5=9C=A8=E6=9B=B4=E6=96=B0=E5=88=99=E5=85=A8?= =?UTF-8?q?=E9=87=8F=E9=87=8D=E5=BB=BA=E7=B4=A2=E5=BC=95=20Fix=20https://g?= =?UTF-8?q?ithub.com/siyuan-note/siyuan/issues/5456?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/index.go | 2 +- kernel/model/repository.go | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/kernel/model/index.go b/kernel/model/index.go index 46cd41c5b..18e245b45 100644 --- a/kernel/model/index.go +++ b/kernel/model/index.go @@ -183,7 +183,7 @@ func (box *Box) Index(fullRebuildIndex bool) (treeCount int, treeSize int64) { } } - bootProgressPart = 40.0 / float64(boxLen) / float64(treeCount) + bootProgressPart = 20.0 / float64(boxLen) / float64(treeCount) i = 0 // 块级行级入库,缓存块 diff --git a/kernel/model/repository.go b/kernel/model/repository.go index 69095c8a4..a85c573b0 100644 --- a/kernel/model/repository.go +++ b/kernel/model/repository.go @@ -455,7 +455,7 @@ func syncRepo(boot, exit, byHand bool) { return } - err = indexRepoBeforeCloudSync(repo) + indexBeforeSync, err := indexRepoBeforeCloudSync(repo) if nil != err { syncDownloadErrCount++ planSyncAfter(fixSyncInterval) @@ -467,9 +467,9 @@ func syncRepo(boot, exit, byHand bool) { if nil != err { return } + syncContext := map[string]interface{}{dejavu.CtxPushMsg: dejavu.CtxPushMsgToStatusBar} _, mergeResult, trafficStat, err := repo.Sync(cloudInfo, syncContext) - elapsed := time.Since(start) if nil != err { syncDownloadErrCount++ @@ -526,9 +526,15 @@ func syncRepo(boot, exit, byHand bool) { treenode.InitBlockTree() } - incReindex(upserts, removes) cache.ClearDocsIAL() // 同步后文档树文档图标没有更新 https://github.com/siyuan-note/siyuan/issues/4939 + fullReindex := 0.2 < float64(len(upserts))/float64(len(indexBeforeSync.Files)) + if fullReindex { + RefreshFileTree() + return + } + incReindex(upserts, removes) + if !boot && !exit { util.ReloadUI() } @@ -543,10 +549,10 @@ func syncRepo(boot, exit, byHand bool) { return } -func indexRepoBeforeCloudSync(repo *dejavu.Repo) (err error) { +func indexRepoBeforeCloudSync(repo *dejavu.Repo) (index *entity.Index, err error) { start := time.Now() latest, _ := repo.Latest() - index, err := repo.Index("[Sync] Cloud sync", map[string]interface{}{ + index, err = repo.Index("[Sync] Cloud sync", map[string]interface{}{ dejavu.CtxPushMsg: dejavu.CtxPushMsgToStatusBar, }) if nil != err { @@ -682,7 +688,7 @@ func subscribeEvents() { eventbus.Subscribe(dejavu.EvtCloudBeforeDownloadFiles, func(context map[string]interface{}, ids []string) { msg := fmt.Sprintf(Conf.Language(165), len(ids)) util.SetBootDetails(msg) - bootProgressPart = 20 / float64(len(ids)) + bootProgressPart = 10 / float64(len(ids)) contextPushMsg(context, msg) }) eventbus.Subscribe(dejavu.EvtCloudBeforeDownloadFile, func(context map[string]interface{}, id string) { @@ -696,7 +702,7 @@ func subscribeEvents() { eventbus.Subscribe(dejavu.EvtCloudBeforeDownloadChunks, func(context map[string]interface{}, ids []string) { msg := fmt.Sprintf(Conf.Language(166), len(ids)) util.SetBootDetails(msg) - bootProgressPart = 20 / float64(len(ids)) + bootProgressPart = 10 / float64(len(ids)) contextPushMsg(context, msg) }) eventbus.Subscribe(dejavu.EvtCloudBeforeDownloadChunk, func(context map[string]interface{}, id string) { From bfb5c0cb967ef858e451e3688d2641fd4e91cf24 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 19 Jul 2022 10:53:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?:art:=20=E8=B0=83=E6=95=B4=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E5=9B=BE=E6=A0=87=E5=A4=A7=E5=B0=8F=20https://github.?= =?UTF-8?q?com/siyuan-note/siyuan/issues/5444?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/electron/main.js | 14 +++++++------- app/stage/icon-large.png | Bin 0 -> 5625 bytes 2 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 app/stage/icon-large.png diff --git a/app/electron/main.js b/app/electron/main.js index ed71d53d9..6ecd667ff 100644 --- a/app/electron/main.js +++ b/app/electron/main.js @@ -55,7 +55,7 @@ const showErrorWindow = (title, content) => { width: screen.getPrimaryDisplay().size.width / 2, height: screen.getPrimaryDisplay().workAreaSize.height / 2, frame: false, - icon: path.join(appDir, 'stage', 'icon.png'), + icon: path.join(appDir, 'stage', 'icon-large.png'), webPreferences: { nativeWindowOpen: true, nodeIntegration: true, @@ -71,7 +71,7 @@ const showErrorWindow = (title, content) => { v: appVer, title: title, content: content, - icon: path.join(appDir, 'stage', 'icon.png'), + icon: path.join(appDir, 'stage', 'icon-large.png'), }, }) errWindow.show() @@ -176,7 +176,7 @@ const boot = () => { }, frame: 'darwin' === process.platform, titleBarStyle: 'hidden', - icon: path.join(appDir, 'stage', 'icon.png'), + icon: path.join(appDir, 'stage', 'icon-large.png'), }) require('@electron/remote/main').enable(mainWindow.webContents) @@ -361,7 +361,7 @@ const boot = () => { if ('win32' === process.platform || 'linux' === process.platform) { // 系统托盘 - tray = new Tray(path.join(appDir, 'stage', 'icon.png')) + tray = new Tray(path.join(appDir, 'stage', 'icon-large.png')) tray.setToolTip('SiYuan') const trayMenuTemplate = [ { @@ -432,7 +432,7 @@ const initKernel = (initData) => { width: screen.getPrimaryDisplay().size.width / 2, height: screen.getPrimaryDisplay().workAreaSize.height / 2, frame: false, - icon: path.join(appDir, 'stage', 'icon.png'), + icon: path.join(appDir, 'stage', 'icon-large.png'), transparent: 'linux' !== process.platform, webPreferences: { nativeWindowOpen: true, @@ -586,7 +586,7 @@ app.whenReady().then(() => { width: screen.getPrimaryDisplay().size.width / 2, height: screen.getPrimaryDisplay().workAreaSize.height / 2, frame: false, - icon: path.join(appDir, 'stage', 'icon.png'), + icon: path.join(appDir, 'stage', 'icon-large.png'), transparent: 'linux' !== process.platform, webPreferences: { nativeWindowOpen: true, @@ -606,7 +606,7 @@ app.whenReady().then(() => { query: { home: app.getPath('home'), v: appVer, - icon: path.join(appDir, 'stage', 'icon.png'), + icon: path.join(appDir, 'stage', 'icon-large.png'), }, }) firstOpenWindow.show() diff --git a/app/stage/icon-large.png b/app/stage/icon-large.png new file mode 100644 index 0000000000000000000000000000000000000000..16c056ad7dc406324616951fb1f6ac8554b1dcf9 GIT binary patch literal 5625 zcmeH~XEEl;2rUCpfo z|1>3ci@0x$)3pzTd=3IX61*CI#f-`~4{ zuDeaZnrjEqjMt_00bEc?f(KicAP55jpFvhOw(+PWQ(2DDuy#754$4$Vs zss*qzk$03jEVB1n7A+z;R<$v2E2l9z{vnodD)ANA>8sFg{Fz-!iYAwyfV=rU6MT+N zMVZ_WLEZ=od}?oj`$1cbB5&kMFj8_8-4wSs``|PN4f-~eD++!g6Rw;{Ulml3oOn2b zPmd;4j`Om^u2XpDszI12eL|mZ;G&W$(w$I0K%Y+IqAV&dN20!=KJCTT-L+#ysQ-YZ zKYF7Sg4T~H1J@IE+nXA97+|f775odN=;*m@t$mL#ELsWLT2$wh zb)+0ugdHa%X;Acoa-KioYNq`+m-CX~q-JXub2)pZd`n8S6Bo^u@gF@`W406VT zj1*!cCL>GPlTH?$1Vu-bJ?BWlZPj2)>CxGC;A4b(fQ5g0mD>emWw%E*zTqh!%h&>3i<4P9p>T2G1QNyPz_2*-IgQt^IDWQ3F#f%B53VgpLF4=K+F z=Y>keE|h33Ql2BuTP78+b;h@!NMi_HHT#UQWeo5PHj>lS>Kd{rPZ^U(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