From 53dbe7eafa69dcea736ba19c66581a80f374b51a Mon Sep 17 00:00:00 2001 From: Anssi Mannila Date: Wed, 6 Oct 2021 14:21:48 +0300 Subject: [PATCH] Fix for xApp transction release place - xApp trasaction release is now done before REST notification is sent to xApp - This makes subscription deletion possible instantly after notification Change-Id: Ia076180aaff40a0b8f8f3c655895a5e37364c5bd Signed-off-by: Anssi Mannila --- pkg/control/control.go | 2 +- pkg/control/ut_messaging_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/control/control.go b/pkg/control/control.go index 1bcffc6..799a307 100755 --- a/pkg/control/control.go +++ b/pkg/control/control.go @@ -511,6 +511,7 @@ func (c *Control) processSubscriptionRequests(restSubscription *RESTSubscription subRespMsg, errorInfo, err := c.handleSubscriptionRequest(trans, &subReqMsg, meid, *restSubId, e2SubscriptionDirectives) xapp.Logger.Debug("Handled SubscriptionRequest index=%v, %s", index, idstring(nil, trans)) + trans.Release() if err != nil { c.sendUnsuccesfullResponseNotification(restSubId, restSubscription, xAppEventInstanceID, err, clientEndpoint, trans, errorInfo) @@ -521,7 +522,6 @@ func (c *Control) processSubscriptionRequests(restSubscription *RESTSubscription index, *restSubId, clientEndpoint.Host, *clientEndpoint.HTTPPort, xAppEventInstanceID, e2EventInstanceID, idstring(nil, trans)) c.sendSuccesfullResponseNotification(restSubId, restSubscription, xAppEventInstanceID, e2EventInstanceID, clientEndpoint, trans) } - trans.Release() } } diff --git a/pkg/control/ut_messaging_test.go b/pkg/control/ut_messaging_test.go index 69e7c1f..9c2874b 100644 --- a/pkg/control/ut_messaging_test.go +++ b/pkg/control/ut_messaging_test.go @@ -6583,9 +6583,9 @@ func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) xappConn1.ExpectRESTNotification(t, restSubId) - // SubsResp is missing - e2SubsId = xappConn1.WaitRESTNotification(t, restSubId) - xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) + // SubsResp is missing, e2SubsId will be 0 + zeroE2SubsId := xappConn1.WaitRESTNotification(t, restSubId) + xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", zeroE2SubsId) // Del xappConn1.SendRESTSubsDelReq(t, &restSubId) -- 2.16.6