mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-16 05:39:54 +05:00
reverted to good add queue version
This commit is contained in:
@@ -75,9 +75,9 @@ func newQueueSaver(saveInterval time.Duration, sq *StatsQueue, adb AccountingSto
|
||||
}
|
||||
|
||||
func (svr *queueSaver) stop() {
|
||||
svr.sq.Save(svr.accountingDb)
|
||||
svr.ticker.Stop()
|
||||
svr.stopper <- true
|
||||
svr.sq.Save(svr.accountingDb)
|
||||
}
|
||||
|
||||
func NewStats(ratingDb RatingStorage, accountingDb AccountingStorage, saveInterval time.Duration) *Stats {
|
||||
@@ -120,10 +120,15 @@ func (s *Stats) AddQueue(cs *CdrStats, out *int) error {
|
||||
if s.queueSavers == nil {
|
||||
s.queueSavers = make(map[string]*queueSaver)
|
||||
}
|
||||
if sq, exists := s.queues[cs.Id]; exists {
|
||||
var sq *StatsQueue
|
||||
var exists bool
|
||||
if sq, exists = s.queues[cs.Id]; exists {
|
||||
sq.UpdateConf(cs)
|
||||
} else {
|
||||
s.queues[cs.Id] = NewStatsQueue(cs)
|
||||
sq = NewStatsQueue(cs)
|
||||
s.queues[cs.Id] = sq
|
||||
}
|
||||
if _, exists = s.queueSavers[sq.GetId()]; !exists {
|
||||
s.setupQueueSaver(sq)
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user