diff --git a/engine/action_plan.go b/engine/action_plan.go index 45a311f9a..424f9bba2 100644 --- a/engine/action_plan.go +++ b/engine/action_plan.go @@ -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) } } } diff --git a/engine/thresholds.go b/engine/thresholds.go index 804d84f82..09b62f05e 100644 --- a/engine/thresholds.go +++ b/engine/thresholds.go @@ -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(" failed executing actions: %s, error: %s", actionSetID, errExec.Error())) + utils.Logger.Warning(fmt.Sprintf(" failed executing actions: %s, error: %s", actID, errExec.Error())) } - }() + }(actionSetID) } else { if errExec := at.Execute(nil, nil); errExec != nil { diff --git a/guardian/guardian_test.go b/guardian/guardian_test.go index 84f62e934..75d29c825 100644 --- a/guardian/guardian_test.go +++ b/guardian/guardian_test.go @@ -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) } } diff --git a/migrator/thresholds_test.go b/migrator/thresholds_test.go index 22e2992c1..2542a64f4 100644 --- a/migrator/thresholds_test.go +++ b/migrator/thresholds_test.go @@ -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