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 <anssi.mannila@nokia.com>
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 @@
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 @@
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 @@
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)