Fix for xApp transction release place 23/6823/1
authorAnssi Mannila <anssi.mannila@nokia.com>
Wed, 6 Oct 2021 11:21:48 +0000 (14:21 +0300)
committerAnssi Mannila <anssi.mannila@nokia.com>
Wed, 6 Oct 2021 11:26:00 +0000 (14:26 +0300)
 - 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 <anssi.mannila@nokia.com>
pkg/control/control.go
pkg/control/ut_messaging_test.go

index 1bcffc6..799a307 100755 (executable)
@@ -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()
        }
 }
 
index 69e7c1f..9c2874b 100644 (file)
@@ -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)