An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Improve WebDAV/S3 data sync request timeout settings https://github.com/siyuan-note/siyuan/issues/12734
Daniele334478214e1
diff --git a/kernel/bazaar/package.go b/kernel/bazaar/package.goindex e9f4df7a31..2a8cc6ab85 100644--- a/kernel/bazaar/package.go+++ b/kernel/bazaar/package.go@@ -484,7 +484,7 @@ func isOutdatedTemplate(template *Template, bazaarTemplates []*Template) bool {func isBazzarOnline() (ret bool) {// Improve marketplace loading when offline https://github.com/siyuan-note/siyuan/issues/12050- ret = util.IsOnline(util.BazaarOSSServer, true)+ ret = util.IsOnline(util.BazaarOSSServer, true, 3000)if !ret {util.PushErrMsg(util.Langs[util.Lang][24], 5000)}diff --git a/kernel/model/sync.go b/kernel/model/sync.goindex 3268d4fdc2..b657497f12 100644--- a/kernel/model/sync.go+++ b/kernel/model/sync.go@@ -648,20 +648,23 @@ func planSyncAfter(d time.Duration) {func isProviderOnline(byHand bool) (ret bool) {checkURL := util.GetCloudSyncServer()skipTlsVerify := false+ timeout := 3000switch Conf.Sync.Provider {case conf.ProviderSiYuan:case conf.ProviderS3:checkURL = Conf.Sync.S3.EndpointskipTlsVerify = Conf.Sync.S3.SkipTlsVerify+ timeout = Conf.Sync.S3.Timeout * 1000case conf.ProviderWebDAV:checkURL = Conf.Sync.WebDAV.EndpointskipTlsVerify = Conf.Sync.WebDAV.SkipTlsVerify+ timeout = Conf.Sync.WebDAV.Timeout * 1000default: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)}diff --git a/kernel/util/net.go b/kernel/util/net.goindex 94d6f91ae8..60b8a2fe9d 100644--- a/kernel/util/net.go+++ b/kernel/util/net.go@@ -72,7 +72,7 @@ func IsLocalOrigin(origin string) bool {return false}-func IsOnline(checkURL string, skipTlsVerify bool) bool {+func IsOnline(checkURL string, skipTlsVerify bool, timeout int) bool {_, err := url.Parse(checkURL)if err != nil {logging.LogWarnf("invalid check URL [%s]", checkURL)@@ -83,7 +83,7 @@ func IsOnline(checkURL string, skipTlsVerify bool) bool {return false}- if isOnline(checkURL, skipTlsVerify) {+ if isOnline(checkURL, skipTlsVerify, timeout) {return true}@@ -104,8 +104,8 @@ func IsPortOpen(port string) bool {return false}-func isOnline(checkURL string, skipTlsVerify bool) (ret bool) {- c := req.C().SetTimeout(3 * time.Second)+func isOnline(checkURL string, skipTlsVerify bool, timeout int) (ret bool) {+ c := req.C().SetTimeout(time.Duration(timeout) * time.Millisecond)if skipTlsVerify {c.EnableInsecureSkipVerify()}