ApierV1.SetThreshods recaching, SetResourceProfile recaching with integration tests

This commit is contained in:
DanB
2017-10-14 17:21:05 +02:00
parent be9539836b
commit 8af75e98db
5 changed files with 16 additions and 17 deletions

View File

@@ -236,8 +236,6 @@ func (tS *ThresholdService) StoreThreshold(t *Threshold) (err error) {
if t.dirty == nil || !*t.dirty {
return
}
guardian.Guardian.GuardIDs(config.CgrConfig().LockingTimeout, utils.ThresholdPrefix+t.TenantID())
defer guardian.Guardian.UnguardIDs(utils.ThresholdPrefix + t.TenantID())
if err = tS.dm.SetThreshold(t); err != nil {
utils.Logger.Warning(
fmt.Sprintf("<ThresholdS> failed saving Threshold with tenant: %s and ID: %s, error: %s",
@@ -328,8 +326,6 @@ func (tS *ThresholdService) processEvent(ev *ThresholdEvent) (hits int, err erro
continue
}
if t.dirty == nil { // one time threshold
lockThreshold := utils.ThresholdPrefix + t.TenantID()
guardian.Guardian.GuardIDs(config.CgrConfig().LockingTimeout, lockThreshold)
if err = tS.dm.RemoveThreshold(t.Tenant, t.ID, utils.NonTransactional); err != nil {
utils.Logger.Warning(
fmt.Sprintf("<ThresholdService> failed removing non-recurrent threshold: %s, error: %s",
@@ -337,7 +333,6 @@ func (tS *ThresholdService) processEvent(ev *ThresholdEvent) (hits int, err erro
withErrors = true
}
guardian.Guardian.UnguardIDs(lockThreshold)
continue
}
t.Snooze = time.Now().Add(t.tPrfl.MinSleep)