for an sqlite database with journal mode != WAL, use maximum of 1 open conn

This commit is contained in:
kim 2024-10-13 22:46:36 +01:00
commit a5bd6328dc

View file

@ -401,6 +401,18 @@ func maxOpenConns() int {
if multiplier < 1 {
return 1
}
// Specifically for SQLite databases with
// a journal mode of anything EXCEPT "wal",
// only 1 concurrent connection is supported.
if strings.ToLower(config.GetDbType()) == "sqlite" {
journalMode := config.GetDbSqliteJournalMode()
journalMode = strings.ToLower(journalMode)
if journalMode != "wal" {
return 1
}
}
return multiplier * runtime.GOMAXPROCS(0)
}