diff --git a/registry/db.go b/registry/db.go index f184864f..d902ec72 100644 --- a/registry/db.go +++ b/registry/db.go @@ -128,11 +128,18 @@ func Open(path string) (*DB, error) { return nil, fmt.Errorf("creating db directory: %w", err) } - conn, err := sql.Open("sqlite3", path+"?_journal_mode=WAL&_foreign_keys=on") + conn, err := sql.Open("sqlite3", path+"?_foreign_keys=on") if err != nil { return nil, fmt.Errorf("opening database: %w", err) } + // WAL mode: enables concurrent reads while writing. + // Persists in the file — any client opening the DB inherits it. + if _, err := conn.Exec("PRAGMA journal_mode=WAL"); err != nil { + conn.Close() + return nil, fmt.Errorf("setting WAL mode: %w", err) + } + if _, err := conn.Exec(schemaSQL); err != nil { conn.Close() return nil, fmt.Errorf("applying schema: %w", err)