mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Implement SharedActionsData for action groups
- holds common relevant data between actions. - currently supports only *cdrlog, making the process more reliable and less repetitive. It also provides access to more information about actions when creating CDRs. - easier to scale. - removes the need for cloning accounts before executing a group of actions. - added Actions method to check if specific action types exist inside.
This commit is contained in:
committed by
Dan Christian Bogos
parent
dd5e5b1147
commit
4cba4a699d
@@ -68,9 +68,8 @@ func (at *ActionTrigger) Execute(acc *Account, fltrS *FilterS) (err error) {
|
||||
at.Executed = true
|
||||
transactionFailed := false
|
||||
removeAccountActionFound := false
|
||||
accClone := acc.Clone() // *cdrlog action requires the original account
|
||||
referenceTime := time.Now()
|
||||
for _, act := range acts {
|
||||
sharedData := NewSharedActionsData(acts)
|
||||
for i, act := range acts {
|
||||
// check action filter
|
||||
if len(act.Filters) > 0 {
|
||||
if pass, err := fltrS.Pass(utils.NewTenantID(act.Id).Tenant, act.Filters,
|
||||
@@ -99,12 +98,8 @@ func (at *ActionTrigger) Execute(acc *Account, fltrS *FilterS) (err error) {
|
||||
transactionFailed = false
|
||||
break
|
||||
}
|
||||
//go utils.Logger.Info(fmt.Sprintf("Executing %v, %v: %v", ub, sq, a))
|
||||
tmpAcc := acc
|
||||
if act.ActionType == utils.CDRLog {
|
||||
tmpAcc = accClone
|
||||
}
|
||||
if err := actionFunction(tmpAcc, act, acts, fltrS, nil, referenceTime,
|
||||
sharedData.idx = i // set the current action index in shared data
|
||||
if err := actionFunction(acc, act, acts, fltrS, nil, sharedData,
|
||||
newActionConnCfg(utils.RALs, act.ActionType, config.CgrConfig())); err != nil {
|
||||
utils.Logger.Err(
|
||||
fmt.Sprintf("Error executing action %s: %v!",
|
||||
|
||||
Reference in New Issue
Block a user