Merge pull request #3065 from chengzhichao-xydt/codex/short-engine-close-errors

fix(seahorse): explicitly ignore Close() errors on PRAGMA/migration failure paths
This commit is contained in:
Mauro 2026-06-13 18:19:35 +02:00 committed by GitHub
commit cf67dd3851
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -113,20 +113,20 @@ func NewEngine(config Config, completeFn CompleteFn) (*Engine, error) {
// Configure SQLite for concurrent access // Configure SQLite for concurrent access
if _, err := db.Exec("PRAGMA journal_mode = WAL;"); err != nil { if _, err := db.Exec("PRAGMA journal_mode = WAL;"); err != nil {
db.Close() _ = db.Close()
return nil, fmt.Errorf("enable WAL: %w", err) return nil, fmt.Errorf("enable WAL: %w", err)
} }
if _, err := db.Exec("PRAGMA busy_timeout = 5000;"); err != nil { if _, err := db.Exec("PRAGMA busy_timeout = 5000;"); err != nil {
db.Close() _ = db.Close()
return nil, fmt.Errorf("set busy_timeout: %w", err) return nil, fmt.Errorf("set busy_timeout: %w", err)
} }
if _, err := db.Exec("PRAGMA synchronous = NORMAL;"); err != nil { if _, err := db.Exec("PRAGMA synchronous = NORMAL;"); err != nil {
db.Close() _ = db.Close()
return nil, fmt.Errorf("set synchronous: %w", err) return nil, fmt.Errorf("set synchronous: %w", err)
} }
if err := runSchema(db); err != nil { if err := runSchema(db); err != nil {
db.Close() _ = db.Close()
return nil, fmt.Errorf("migrations: %w", err) return nil, fmt.Errorf("migrations: %w", err)
} }