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:
commit
cf67dd3851
1 changed files with 4 additions and 4 deletions
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue