enable WAL
Build and Push Docker Image / build-and-push (push) Successful in 3m59s

Signed-off-by: kaedwen <kaedwen@heinrich.blue>
This commit is contained in:
kaedwen committed 2026-07-04 20:26:04 +02:00
1 parent 7387c57403
commit c84cc19c2e
3 files changed
+8 -11

No files matched your search

+6 -1
View File
@@ -39,11 +39,16 @@ func New(dbPath string, logger *slog.Logger) (Database, error) {
// Open database
// Note: Using modernc.org/sqlite (pure Go, no CGO) instead of mattn/go-sqlite3
db, err := sql.Open("sqlite", dbPath+"?_pragma=busy_timeout(5000)")
db, err := sql.Open("sqlite", dbPath+"?_pragma=busy_timeout(10000)&_pragma=journal_mode(WAL)&_pragma=synchronous(NORMAL)")
if err != nil {
return nil, fmt.Errorf("failed to open database: %w", err)
}
// Set connection pool limits to prevent "database is locked" errors
db.SetMaxOpenConns(1) // SQLite works best with single writer
db.SetMaxIdleConns(1)
db.SetConnMaxLifetime(0) // connections don't expire
// Test connection
if err := db.Ping(); err != nil {
db.Close()