mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-10-11 16:30:11 +00:00
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:
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user