🎨 桌面端自动更新安装包不进行并发下载 Fix https://github.com/siyuan-note/siyuan/issues/6175

This commit is contained in:
Liang Ding 2022-10-13 12:05:47 +08:00
parent 0b7c6a851e
commit e35d9eb84b
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -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)