From a7533b1a5d8af2d379c20c55cde38cf62f2d028d Mon Sep 17 00:00:00 2001 From: Trial97 Date: Mon, 28 Sep 2020 09:16:50 +0300 Subject: [PATCH] Removed unneeded event clone from sessions --- sessions/sessions.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sessions/sessions.go b/sessions/sessions.go index 85e6be240..694164a1d 100644 --- a/sessions/sessions.go +++ b/sessions/sessions.go @@ -2421,7 +2421,7 @@ func (sS *SessionS) BiRPCv1UpdateSession(clnt rpcclient.ClientConnector, if args.GetAttributes { rplyAttr, err := sS.processAttributes(args.CGREvent, args.AttributeIDs, args.Opts) if err == nil { - args.CGREvent = rplyAttr.CGREvent.Clone() + args.CGREvent = rplyAttr.CGREvent args.Opts = rplyAttr.Opts rply.Attributes = &rplyAttr } else if err.Error() != utils.ErrNotFound.Error() { @@ -2452,7 +2452,7 @@ func (sS *SessionS) BiRPCv1UpdateSession(clnt rpcclient.ClientConnector, } } var sRunsUsage map[string]time.Duration - if sRunsUsage, err = sS.updateSession(s, ev.Clone(), args.Opts, false); err != nil { + if sRunsUsage, err = sS.updateSession(s, ev, args.Opts, false); err != nil { return utils.NewErrRALs(err) } var maxUsage time.Duration @@ -2907,7 +2907,7 @@ func (sS *SessionS) BiRPCv1ProcessMessage(clnt rpcclient.ClientConnector, var maxUsage time.Duration if maxUsage, err = sS.chargeEvent(&utils.CGREventWithOpts{ CGREvent: args.CGREvent, - Opts: engine.MapEvent(args.Opts).Clone(), + Opts: args.Opts, }, args.ForceDuration); err != nil { return err } @@ -3111,7 +3111,7 @@ func (sS *SessionS) BiRPCv1ProcessEvent(clnt rpcclient.ClientConnector, return utils.NewErrAttributeS(err) } } else { - cgrEv.CGREvent = rplyAttr.CGREvent.Clone() + cgrEv.CGREvent = rplyAttr.CGREvent cgrEv.Opts = rplyAttr.Opts rply.Attributes[runID] = &rplyAttr } @@ -3521,7 +3521,7 @@ func (sS *SessionS) BiRPCv1GetCost(clnt rpcclient.ClientConnector, rplyAttr, err := sS.processAttributes(args.CGREvent, argsFlagsWithParams.ParamsSlice(utils.MetaAttributes, utils.MetaIDs), args.Opts) if err == nil { - args.CGREvent = rplyAttr.CGREvent.Clone() + args.CGREvent = rplyAttr.CGREvent args.Opts = rplyAttr.Opts rply.Attributes = &rplyAttr } else if err.Error() != utils.ErrNotFound.Error() { @@ -3529,7 +3529,7 @@ func (sS *SessionS) BiRPCv1GetCost(clnt rpcclient.ClientConnector, } } //compose the CallDescriptor with Args - me := engine.MapEvent(args.CGREvent.Event).Clone() + me := engine.MapEvent(args.CGREvent.Event) startTime := me.GetTimeIgnoreErrors(utils.AnswerTime, sS.cgrCfg.GeneralCfg().DefaultTimezone) if startTime.IsZero() { // AnswerTime not parsable, try SetupTime