mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
renamed QueuedItems to QueueLenth
This commit is contained in:
@@ -22,7 +22,7 @@ import "time"
|
||||
|
||||
type CdrStats struct {
|
||||
Id string // Config id, unique per config instance
|
||||
QueuedItems int // Number of items in the stats buffer
|
||||
QueueLength int // Number of items in the stats buffer
|
||||
TimeWindow time.Duration // Will only keep the CDRs who's call setup time is not older than time.Now()-TimeWindow
|
||||
Metrics []string // ASR, ACD, ACC
|
||||
SetupInterval []time.Time // 2 or less items (>= start interval,< stop_interval)
|
||||
|
||||
@@ -101,7 +101,7 @@ func UpdateCdrStats(cs *CdrStats, triggers ActionTriggerPriotityList, record ...
|
||||
cs.Id = record[0]
|
||||
if record[1] != "" {
|
||||
if qi, err := strconv.Atoi(record[1]); err == nil {
|
||||
cs.QueuedItems = qi
|
||||
cs.QueueLength = qi
|
||||
} else {
|
||||
log.Printf("Error parsing QueuedItems %v for cdrs stats %v", record[1], cs.Id)
|
||||
}
|
||||
|
||||
@@ -113,13 +113,13 @@ func (sq *StatsQueue) simplifyCDR(cdr *utils.StoredCdr) *QCDR {
|
||||
}
|
||||
|
||||
func (sq *StatsQueue) purgeObsoleteCDRs() {
|
||||
if sq.conf.QueuedItems > 0 {
|
||||
if sq.conf.QueueLength > 0 {
|
||||
currentLength := len(sq.cdrs)
|
||||
if currentLength > sq.conf.QueuedItems {
|
||||
for _, cdr := range sq.cdrs[:currentLength-sq.conf.QueuedItems] {
|
||||
if currentLength > sq.conf.QueueLength {
|
||||
for _, cdr := range sq.cdrs[:currentLength-sq.conf.QueueLength] {
|
||||
sq.removeFromMetrics(cdr)
|
||||
}
|
||||
sq.cdrs = sq.cdrs[currentLength-sq.conf.QueuedItems:]
|
||||
sq.cdrs = sq.cdrs[currentLength-sq.conf.QueueLength:]
|
||||
}
|
||||
}
|
||||
if sq.conf.TimeWindow > 0 {
|
||||
|
||||
Reference in New Issue
Block a user