fix: SQLite WAL mode + log all swallowed 500 errors
- internal/db/db.go: Use _pragma syntax so modernc.org/sqlite actually applies busy_timeout(5000) and journal_mode(WAL). Eliminates SQLITE_BUSY 500s when concurrent reads hit a writer holding the DELETE-mode lock. - internal/api/handlers_*.go: Add slog.Error before every writeError with StatusInternalServerError so real errors appear in logs (30+ sites across handlers_jobs, handlers_machines, handlers_syncpairs, handlers_sshkeys).
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@ func Open(dbPath string) (*DB, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
db, err := sql.Open("sqlite", dbPath+"?_journal_mode=WAL&_foreign_keys=ON&_busy_timeout=5000")
|
||||
db, err := sql.Open("sqlite", dbPath+"?_pragma=busy_timeout(5000)&_pragma=journal_mode(WAL)")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("opening db: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user