mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Fixup concurrency on mediation runs and stats, improving tutorial CdrStats files
This commit is contained in:
@@ -175,11 +175,11 @@ func (self *Mediator) RateCdr(storedCdr *utils.StoredCdr, sendToStats bool) erro
|
||||
}
|
||||
}
|
||||
if sendToStats && self.stats != nil { // We send to stats only after saving to db since there are chances we cannot store and then no way to reproduce stats offline
|
||||
go func() {
|
||||
go func(cdr *utils.StoredCdr) { // Pass it by value since the variable will be overwritten by for
|
||||
if err := self.stats.AppendCDR(cdr, nil); err != nil {
|
||||
Logger.Err(fmt.Sprintf("Could not append cdr to stats (mediator): %s", err.Error()))
|
||||
}
|
||||
}()
|
||||
}(cdr)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user