fix: use execcontext in db
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
|
||||
@@ -17,7 +18,7 @@ func Open(dbFile string) (*sql.DB, error) {
|
||||
return nil, fmt.Errorf("failed to open db: %w", err)
|
||||
}
|
||||
// WAL improves concurrency between readers and writers.
|
||||
_, _ = db.Exec("PRAGMA journal_mode=WAL;")
|
||||
_, _ = db.Exec("PRAGMA busy_timeout=5000;")
|
||||
_, _ = db.ExecContext(context.Background(), "PRAGMA journal_mode=WAL;")
|
||||
_, _ = db.ExecContext(context.Background(), "PRAGMA busy_timeout=5000;")
|
||||
return db, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user