mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 23:50:13 +01:00
🎨 改进内核任务调度机制提升稳定性 https://github.com/siyuan-note/siyuan/issues/7113
This commit is contained in:
parent
1da37af586
commit
1a00b75192
2 changed files with 0 additions and 31 deletions
|
|
@ -495,9 +495,6 @@ func fullReindex() {
|
||||||
}
|
}
|
||||||
treenode.InitBlockTree(true)
|
treenode.InitBlockTree(true)
|
||||||
|
|
||||||
sql.IndexMode()
|
|
||||||
defer sql.NormalMode()
|
|
||||||
|
|
||||||
openedBoxes := Conf.GetOpenedBoxes()
|
openedBoxes := Conf.GetOpenedBoxes()
|
||||||
for _, openedBox := range openedBoxes {
|
for _, openedBox := range openedBoxes {
|
||||||
index(openedBox.ID)
|
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() {
|
func initDBConnection() {
|
||||||
if nil != db {
|
if nil != db {
|
||||||
db.Close()
|
db.Close()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue