mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
close db connections in test flush helpers
Previously, database connections would stay alive until "go test" would finish, sometimes leading to max conn errors.
This commit is contained in:
committed by
Dan Christian Bogos
parent
427c6aef10
commit
0feda9e993
@@ -292,6 +292,7 @@ func InitDataDb(cfg *config.CGRConfig) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer d.Close()
|
||||
dm := NewDataManager(d, cfg.CacheCfg(), connMgr)
|
||||
|
||||
if err := dm.DataDB().Flush(""); err != nil {
|
||||
@@ -315,6 +316,7 @@ func InitStorDb(cfg *config.CGRConfig) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer storDb.Close()
|
||||
db_Path := strings.Trim(cfg.StorDbCfg().Type, "*")
|
||||
if err := storDb.Flush(path.Join(cfg.DataFolderPath, "storage",
|
||||
db_Path)); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user