From e35d9eb84b24e8ec65c9c6c04b44e596d0d9dcd3 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 13 Oct 2022 12:05:47 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=A1=8C=E9=9D=A2=E7=AB=AF=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=9B=B4=E6=96=B0=E5=AE=89=E8=A3=85=E5=8C=85=E4=B8=8D?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E5=B9=B6=E5=8F=91=E4=B8=8B=E8=BD=BD=20Fix=20?= =?UTF-8?q?https://github.com/siyuan-note/siyuan/issues/6175?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/updater.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/model/updater.go b/kernel/model/updater.go index a94c083b9..0ba434d08 100644 --- a/kernel/model/updater.go +++ b/kernel/model/updater.go @@ -156,8 +156,10 @@ func downloadInstallPkg(pkgURL, checksum string) { logging.LogInfof("downloading install package [%s]", pkgURL) msgId := util.PushMsg(Conf.Language(103), 60*1000*10) client := req.C().SetTLSHandshakeTimeout(7 * time.Second).SetTimeout(10 * time.Minute) - err = client.NewParallelDownload(pkgURL).SetConcurrency(8).SetSegmentSize(1024 * 1024 * 2). - SetOutputFile(savePath).Do() + callback := func(info req.DownloadInfo) { + //logging.LogDebugf("downloading install package [%s %.2f%%]", pkgURL, float64(info.DownloadedSize)/float64(info.Response.ContentLength)*100.0) + } + _, err = client.R().SetOutputFile(savePath).SetDownloadCallback(callback).Get(pkgURL) if nil != err { logging.LogErrorf("download install package failed: %s", err) util.PushUpdateMsg(msgId, Conf.Language(104), 7000)