Move TPReader.Init() outside of ReloadCache

This commit is contained in:
TeoV
2019-11-25 11:33:39 +02:00
parent 139552bed6
commit 0e97bb5015
7 changed files with 27 additions and 3 deletions

View File

@@ -354,6 +354,8 @@ func (apiv1 *ApierV1) LoadTariffPlanFromStorDb(attrs AttrLoadTpFromStorDb, reply
return utils.NewErrServerError(err)
}
}
// release the reader with it's structures
dbReader.Init()
*reply = utils.OK
return nil
}
@@ -885,6 +887,8 @@ func (apiv1 *ApierV1) LoadTariffPlanFromFolder(attrs utils.AttrLoadTpFromFolder,
return utils.NewErrServerError(err)
}
}
// release the reader with it's structures
loader.Init()
*reply = utils.OK
return nil
}
@@ -948,6 +952,8 @@ func (apiv1 *ApierV1) RemoveTPFromFolder(attrs utils.AttrLoadTpFromFolder, reply
return utils.NewErrServerError(err)
}
}
// release the reader with it's structures
loader.Init()
*reply = utils.OK
return nil
}
@@ -997,7 +1003,8 @@ func (apiv1 *ApierV1) RemoveTPFromStorDB(attrs AttrLoadTpFromStorDb, reply *stri
return utils.NewErrServerError(err)
}
}
// release the reader with it's structures
dbReader.Init()
*reply = utils.OK
return nil
}

View File

@@ -150,6 +150,8 @@ func (self *ApierV2) LoadTariffPlanFromFolder(attrs utils.AttrLoadTpFromFolder,
return utils.NewErrServerError(err)
}
}
// release the reader with it's structures
loader.Init()
loadHistList, err := self.DataManager.DataDB().GetLoadHistory(1, true, utils.NonTransactional)
if err != nil {
return err

View File

@@ -378,6 +378,8 @@ func main() {
log.Fatal("Could not reload scheduler: ", err)
}
}
// release the reader with it's structures
tpReader.Init()
} else {
if err := tpReader.RemoveFromDatabase(*verbose, *disableReverse); err != nil {
log.Fatal("Could not delete from database: ", err)

View File

@@ -81,4 +81,10 @@
},
"apier": {
"scheduler_conns": [
{"address": "*internal"},
],
},
}

View File

@@ -81,4 +81,11 @@
},
"apier": {
"scheduler_conns": [
{"address": "*internal"},
],
},
}

View File

@@ -154,4 +154,6 @@
{"address": "*internal"},
],
},
}

View File

@@ -2512,8 +2512,6 @@ func (tpr *TpReader) ReloadCache(caching string, verbose bool, argDispatcher *ut
Cache.Set(utils.CacheLoadIDs, key, val, nil,
cacheCommit(utils.NonTransactional), utils.NonTransactional)
}
// release the reader with it's structures
tpr.Init()
return
}