Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: 使用第三方同步盘时弹出提示并退出内核 https://github.com/siyuan-note/siyuan/issues/7683

Liang Ding042daa73e5c8
diff --git a/kernel/util/runtime.go b/kernel/util/runtime.go
index 36a1868960..bda1629f9b 100644
--- a/kernel/util/runtime.go
+++ b/kernel/util/runtime.go
@@ -147,7 +147,7 @@ func CheckFileSysStatus() {
os.Exit(ExitCodeFileSysInconsistent)
}
- const fileSysStatusCheckFile = "filesys_status_check"
+ const fileSysStatusCheckFile = ".siyuan/filesys_status_check"
for {
workspaceDirLower := strings.ToLower(WorkspaceDir)
@@ -168,7 +168,7 @@ func CheckFileSysStatus() {
continue
}
- for i := 0; i < 16; i++ {
+ for i := 0; i < 32; i++ {
tmp := filepath.Join(dir, "check_"+gulu.Rand.String(7))
data := make([]byte, 1024*4)
_, err := rand.Read(data)
@@ -184,7 +184,7 @@ func CheckFileSysStatus() {
time.Sleep(time.Second)
- for j := 0; j < 64; j++ {
+ for j := 0; j < 32; j++ {
f, err := os.Open(tmp)
if nil != err {
reportFileSysFatalError(err)
@@ -196,35 +196,35 @@ func CheckFileSysStatus() {
break
}
- time.Sleep(100 * time.Millisecond)
+ time.Sleep(200 * time.Millisecond)
if err = os.Rename(tmp, tmp+"_1"); nil != err {
reportFileSysFatalError(err)
break
}
- time.Sleep(100 * time.Millisecond)
+ time.Sleep(200 * time.Millisecond)
if err = os.Rename(tmp+"_1", tmp); nil != err {
reportFileSysFatalError(err)
break
}
- }
- entries, err := os.ReadDir(dir)
- if nil != err {
- reportFileSysFatalError(err)
- break
- }
+ entries, err := os.ReadDir(dir)
+ if nil != err {
+ reportFileSysFatalError(err)
+ break
+ }
- count := 0
- for _, entry := range entries {
- if !entry.IsDir() && strings.Contains(entry.Name(), "check_") {
- count++
+ count := 0
+ for _, entry := range entries {
+ if !entry.IsDir() && strings.Contains(entry.Name(), "check_") {
+ count++
+ }
+ }
+ if 1 < count {
+ reportFileSysFatalError(fmt.Errorf("dir [%s] has more than 1 file", dir))
+ break
}
- }
- if 1 < count {
- reportFileSysFatalError(fmt.Errorf("dir [%s] has more than 1 file", dir))
- break
}
if err = os.RemoveAll(tmp); nil != err {