🎨 Improve WebDAV/S3 data sync request timeout settings https://github.com/siyuan-note/siyuan/issues/12734

This commit is contained in:
Daniel 2024-10-08 17:06:13 +08:00
parent 61e07a1ed1
commit e334478214
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 9 additions and 6 deletions

View file

@ -648,20 +648,23 @@ func planSyncAfter(d time.Duration) {
func isProviderOnline(byHand bool) (ret bool) {
checkURL := util.GetCloudSyncServer()
skipTlsVerify := false
timeout := 3000
switch Conf.Sync.Provider {
case conf.ProviderSiYuan:
case conf.ProviderS3:
checkURL = Conf.Sync.S3.Endpoint
skipTlsVerify = Conf.Sync.S3.SkipTlsVerify
timeout = Conf.Sync.S3.Timeout * 1000
case conf.ProviderWebDAV:
checkURL = Conf.Sync.WebDAV.Endpoint
skipTlsVerify = Conf.Sync.WebDAV.SkipTlsVerify
timeout = Conf.Sync.WebDAV.Timeout * 1000
default:
logging.LogWarnf("unknown provider: %d", Conf.Sync.Provider)
return false
}
if ret = util.IsOnline(checkURL, skipTlsVerify); !ret {
if ret = util.IsOnline(checkURL, skipTlsVerify, timeout); !ret {
if 1 > autoSyncErrCount || byHand {
util.PushErrMsg(Conf.Language(76)+" (Provider: "+conf.ProviderToStr(Conf.Sync.Provider)+")", 5000)
}