mirror of
https://codeberg.org/superseriousbusiness/gotosocial.git
synced 2024-12-18 07:01:49 +03:00
[feature] for an sqlite database with journal mode != WAL, use maximum of 1 open conn (#3428)
This commit is contained in:
parent
096767bb3b
commit
2076f7d85f
1 changed files with 12 additions and 0 deletions
|
@ -401,6 +401,18 @@ func maxOpenConns() int {
|
||||||
if multiplier < 1 {
|
if multiplier < 1 {
|
||||||
return 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)
|
return multiplier * runtime.GOMAXPROCS(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue