mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Make sure no loop variables are captured by func literals
This commit is contained in:
committed by
Dan Christian Bogos
parent
c7d226f8bb
commit
ae67776d30
@@ -429,7 +429,7 @@ func (at *ActionTiming) Execute(successActions, failedActions chan *Action) (err
|
||||
break
|
||||
}
|
||||
if successActions != nil {
|
||||
go func() { successActions <- a }()
|
||||
go func(action *Action) { successActions <- action }(a)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,11 +95,11 @@ func (t *Threshold) ProcessEvent(args *ArgsProcessEvent, dm *DataManager) (err e
|
||||
}
|
||||
if t.tPrfl.Async {
|
||||
|
||||
go func() {
|
||||
go func(actID string) {
|
||||
if errExec := at.Execute(nil, nil); errExec != nil {
|
||||
utils.Logger.Warning(fmt.Sprintf("<ThresholdS> failed executing actions: %s, error: %s", actionSetID, errExec.Error()))
|
||||
utils.Logger.Warning(fmt.Sprintf("<ThresholdS> failed executing actions: %s, error: %s", actID, errExec.Error()))
|
||||
}
|
||||
}()
|
||||
}(actionSetID)
|
||||
|
||||
} else {
|
||||
if errExec := at.Execute(nil, nil); errExec != nil {
|
||||
|
||||
@@ -270,11 +270,11 @@ func BenchmarkGuardian(b *testing.B) {
|
||||
// BenchmarkGuardIDs-8 1000000 8732 ns/op
|
||||
func BenchmarkGuardIDs(b *testing.B) {
|
||||
for n := 0; n < b.N; n++ {
|
||||
go func() {
|
||||
if refID := Guardian.GuardIDs("", 0, strconv.Itoa(n)); refID != "" {
|
||||
go func(lockID int) {
|
||||
if refID := Guardian.GuardIDs("", 0, strconv.Itoa(lockID)); refID != "" {
|
||||
time.Sleep(time.Microsecond)
|
||||
Guardian.UnguardIDs(refID)
|
||||
}
|
||||
}()
|
||||
}(n)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
func Testv2ActionTriggerAsThreshold(t *testing.T) {
|
||||
func TestV2ActionTriggerAsThreshold(t *testing.T) {
|
||||
var filters []*engine.FilterRule
|
||||
v2ATR := &v2ActionTrigger{
|
||||
ID: "test2", // original csv tag
|
||||
|
||||
Reference in New Issue
Block a user