make configurable wal auto checkpoint (#2242)

This commit is contained in:
Kristoffer Dalby authored and GitHub committed 2024-11-23 21:03:48 +01:00
1 parent dc17b4d378
commit 64bb56352f
3 files changed
+14 -6

No files matched your search

+3 -3
View File
@@ -543,10 +543,10 @@ func openDB(cfg types.DatabaseConfig) (*gorm.DB, error) {
}
if cfg.Sqlite.WriteAheadLog {
if err := db.Exec(`
if err := db.Exec(fmt.Sprintf(`
PRAGMA journal_mode=WAL;
PRAGMA wal_autocheckpoint=0;
`).Error; err != nil {
PRAGMA wal_autocheckpoint=%d;
`, cfg.Sqlite.WALAutoCheckPoint)).Error; err != nil {
return nil, fmt.Errorf("setting WAL mode: %w", err)
}
}