fix🐛: give sqlite connections a busy timeout, WAL and immediate transactions

A file-backed sqlite database ran in rollback-journal mode with no busy
timeout, so concurrent requests failed with "database is locked" instead of
waiting for each other. Add the defaults to the sqlite3 connection string
unless the configured source already sets them.
This commit is contained in:
zhangwenjian
2026-10-07 17:32:39 +08:00
parent 386ddeae82
commit ea679bf00b
4 changed files with 202 additions and 0 deletions
+1
View File
@@ -41,6 +41,7 @@ func setupSimpleDatabase(host string, c *toolsConfig.Database) {
if err != nil {
log.Fatal(pkg.Red(err.Error()))
}
open = withSqliteDefaults(c.Driver, open)
resolverConfig := toolsDB.NewConfigure(c.Source, c.MaxIdleConns, c.MaxOpenConns, c.ConnMaxIdleTime, c.ConnMaxLifeTime, registers)
db, err := resolverConfig.Init(&gorm.Config{