mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-16 17:10:53 +08:00
🎨 改进内核任务调度机制提升稳定性 https://github.com/siyuan-note/siyuan/issues/7113
This commit is contained in:
parent
1da37af586
commit
1a00b75192
@ -495,9 +495,6 @@ func fullReindex() {
|
||||
}
|
||||
treenode.InitBlockTree(true)
|
||||
|
||||
sql.IndexMode()
|
||||
defer sql.NormalMode()
|
||||
|
||||
openedBoxes := Conf.GetOpenedBoxes()
|
||||
for _, openedBox := range openedBoxes {
|
||||
index(openedBox.ID)
|
||||
|
@ -206,34 +206,6 @@ func initHistoryDBTables() {
|
||||
}
|
||||
}
|
||||
|
||||
func IndexMode() {
|
||||
if nil != db {
|
||||
db.Close()
|
||||
}
|
||||
dsn := util.DBPath + "?_journal_mode=OFF" +
|
||||
"&_synchronous=OFF" +
|
||||
"&_secure_delete=OFF" +
|
||||
"&_cache_size=-20480" +
|
||||
"&_page_size=8192" +
|
||||
"&_busy_timeout=7000" +
|
||||
"&_ignore_check_constraints=ON" +
|
||||
"&_temp_store=MEMORY" +
|
||||
"&_case_sensitive_like=OFF" +
|
||||
"&_locking_mode=EXCLUSIVE"
|
||||
var err error
|
||||
db, err = sql.Open("sqlite3_extended", dsn)
|
||||
if nil != err {
|
||||
logging.LogFatalf("create database failed: %s", err)
|
||||
}
|
||||
db.SetMaxIdleConns(1)
|
||||
db.SetMaxOpenConns(1)
|
||||
db.SetConnMaxLifetime(365 * 24 * time.Hour)
|
||||
}
|
||||
|
||||
func NormalMode() {
|
||||
initDBConnection()
|
||||
}
|
||||
|
||||
func initDBConnection() {
|
||||
if nil != db {
|
||||
db.Close()
|
||||
|
Loading…
Reference in New Issue
Block a user