Protect Trend.asTrendSummary method

This commit is contained in:
DanB
2024-10-17 16:15:39 +02:00
parent bb42cbac42
commit e3f5b2f264
2 changed files with 7 additions and 3 deletions

View File

@@ -123,7 +123,7 @@ func (t *Trend) Clone() (tC *Trend) {
}
// AsTrendSummary transforms the trend into TrendSummary
func (t *Trend) AsTrendSummary() (ts *TrendSummary) {
func (t *Trend) asTrendSummary() (ts *TrendSummary) {
ts = &TrendSummary{
Tenant: t.Tenant,
ID: t.ID,

View File

@@ -180,7 +180,9 @@ func (tS *TrendS) processThresholds(trnd *Trend) (err error) {
copy(thIDs, trnd.tPrfl.ThresholdIDs)
}
opts[utils.OptsThresholdsProfileIDs] = thIDs
ts := trnd.AsTrendSummary()
trnd.tMux.RLock()
ts := trnd.asTrendSummary()
trnd.tMux.RUnlock()
trndEv := &utils.CGREvent{
Tenant: trnd.Tenant,
ID: utils.GenUUID(),
@@ -218,7 +220,9 @@ func (tS *TrendS) processEEs(trnd *Trend) (err error) {
opts := map[string]any{
utils.MetaEventType: utils.TrendUpdate,
}
ts := trnd.AsTrendSummary()
trnd.tMux.RLock()
ts := trnd.asTrendSummary()
trnd.tMux.RUnlock()
trndEv := &CGREventWithEeIDs{
CGREvent: &utils.CGREvent{
Tenant: trnd.Tenant,