mirror of
https://github.com/ddworken/hishtory.git
synced 2024-12-25 16:28:53 +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 {
|
||||
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")
|
||||
AddDatabaseTables(db)
|
||||
return db, nil
|
||||
|
Loading…
Reference in New Issue
Block a user