renamed QueuedItems to QueueLenth

This commit is contained in:
Radu Ioan Fericean
2014-07-29 17:14:05 +03:00
parent 1f28e2bc2c
commit 8ee8962328
3 changed files with 6 additions and 6 deletions

View File

@@ -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)

View File

@@ -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)
}

View File

@@ -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 {