mirror of
https://github.com/ddworken/hishtory.git
synced 2024-11-25 01:33:28 +01:00
Set max open conns to 1 for test code to fix race conditions that lead to flaky tests
This commit is contained in:
parent
413e2e438f
commit
8dc5168c64
@ -493,6 +493,11 @@ func OpenDB() (*gorm.DB, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to connect to the DB: %v", err)
|
return nil, fmt.Errorf("failed to connect to the DB: %v", err)
|
||||||
}
|
}
|
||||||
|
underlyingDb, err := db.DB()
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to access underlying DB: %v", err)
|
||||||
|
}
|
||||||
|
underlyingDb.SetMaxOpenConns(1)
|
||||||
db.Exec("PRAGMA journal_mode = WAL")
|
db.Exec("PRAGMA journal_mode = WAL")
|
||||||
AddDatabaseTables(db)
|
AddDatabaseTables(db)
|
||||||
return db, nil
|
return db, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user