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: Add retry to improve network check
Liang Dingde1c01a2e8dc
diff --git a/kernel/model/sync.go b/kernel/model/sync.goindex 3da7362141..94afe9ba53 100644--- a/kernel/model/sync.go+++ b/kernel/model/sync.go@@ -576,7 +576,7 @@ func isProviderOnline() (ret bool) {checkURL = Conf.Sync.WebDAV.Endpointdefault:logging.LogWarnf("unknown provider: %d", Conf.Sync.Provider)- util.IsOnline("")+ return false}if ret = util.IsOnline(checkURL); !ret {diff --git a/kernel/util/net.go b/kernel/util/net.goindex 7da8f1e38d..b1c550dfe8 100644--- a/kernel/util/net.go+++ b/kernel/util/net.go@@ -33,19 +33,6 @@ import (func IsOnline(checkURL string) bool {if "" == checkURL {- if isOnline("https://www.baidu.com") {- return true- }-- if isOnline("https://icanhazip.com") {- return true- }-- if isOnline("https://api.ipify.org") {- return true- }-- logging.LogWarnf("network is offline")return false}@@ -57,10 +44,16 @@ func IsOnline(checkURL string) bool {return false}-func isOnline(checkURL string) bool {- c := req.C().SetTimeout(1 * time.Second)- _, err := c.R().Head(checkURL)- return nil == err+func isOnline(checkURL string) (ret bool) {+ for i := 0; i < 3; i++ {+ c := req.C().SetTimeout(3 * time.Second)+ _, err := c.R().Head(checkURL)+ ret = nil == err+ if ret {+ break+ }+ }+ return}func GetRemoteAddr(session *melody.Session) string {