From: Anssi Mannila Date: Wed, 6 Oct 2021 11:21:48 +0000 (+0300) Subject: Fix for xApp transction release place X-Git-Tag: 0.8.0~13 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;ds=sidebyside;h=refs%2Fchanges%2F23%2F6823%2F1;hp=08c8fbd6d2d26e17b87aac8438d035813170bc91;p=ric-plt%2Fsubmgr.git 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 --- 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)