mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-21 15:18:44 +05:00
Updated threshold processing for resources
This commit is contained in:
committed by
Dan Christian Bogos
parent
cd6a013b1e
commit
3d3540b486
@@ -701,19 +701,18 @@ func (rS *ResourceService) V1AllocateResources(args utils.ArgRSv1ResourceUsage,
|
||||
|
||||
// index it for storing
|
||||
for _, r := range mtcRLs {
|
||||
if rS.cgrcfg.ResourceSCfg().StoreInterval == 0 || r.dirty == nil {
|
||||
continue
|
||||
}
|
||||
if rS.cgrcfg.ResourceSCfg().StoreInterval == -1 {
|
||||
*r.dirty = true
|
||||
if err = rS.StoreResource(r); err != nil {
|
||||
return
|
||||
if rS.cgrcfg.ResourceSCfg().StoreInterval != 0 && r.dirty != nil {
|
||||
if rS.cgrcfg.ResourceSCfg().StoreInterval == -1 {
|
||||
*r.dirty = true
|
||||
if err = rS.StoreResource(r); err != nil {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
*r.dirty = true // mark it to be saved
|
||||
rS.srMux.Lock()
|
||||
rS.storedResources.Add(r.TenantID())
|
||||
rS.srMux.Unlock()
|
||||
}
|
||||
} else {
|
||||
*r.dirty = true // mark it to be saved
|
||||
rS.srMux.Lock()
|
||||
rS.storedResources.Add(r.TenantID())
|
||||
rS.srMux.Unlock()
|
||||
}
|
||||
if err = rS.processThresholds(r, args.APIOpts); err != nil {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user