SessionS - cloning AttributeS event to avoid concurrency

This commit is contained in:
DanB
2020-01-08 14:03:48 +01:00
parent cdafb21fee
commit 771a1245d8

View File

@@ -2084,7 +2084,7 @@ func (sS *SessionS) BiRPCv1InitiateSession(clnt rpcclient.ClientConnector,
rplyAttr, err := sS.processAttributes(args.CGREvent, args.ArgDispatcher,
args.AttributeIDs)
if err == nil {
args.CGREvent = rplyAttr.CGREvent
args.CGREvent = rplyAttr.CGREvent.Clone() // avoid concurrency with rply.Attributes
if tntIface, has := args.CGREvent.Event[utils.MetaTenant]; has {
// special case when we want to overwrite the tenant
args.CGREvent.Tenant = tntIface.(string)
@@ -2307,7 +2307,7 @@ func (sS *SessionS) BiRPCv1UpdateSession(clnt rpcclient.ClientConnector,
rplyAttr, err := sS.processAttributes(args.CGREvent, args.ArgDispatcher,
args.AttributeIDs)
if err == nil {
args.CGREvent = rplyAttr.CGREvent
args.CGREvent = rplyAttr.CGREvent.Clone()
if tntIface, has := args.CGREvent.Event[utils.MetaTenant]; has {
// special case when we want to overwrite the tenant
args.CGREvent.Tenant = tntIface.(string)