Fix for Submgr crash problem
[ric-plt/submgr.git] / pkg / control / control.go
index 14bf034..3ebcbcd 100755 (executable)
@@ -142,25 +142,6 @@ func NewControl() *Control {
        // Read subscriptions from db
        c.ReadE2Subscriptions()
        c.ReadRESTSubscriptions()
-
-       /*
-               xapp.Logger.Info("Reading subscriptions from db")
-               subIds, register, err := c.ReadAllSubscriptionsFromSdl()
-               if err != nil {
-                       xapp.Logger.Error("%v", err)
-               } else {
-                       c.registry.subIds = subIds
-                       c.registry.register = register
-                       c.HandleUncompletedSubscriptions(register)
-               }
-
-               restSubscriptions, err := c.ReadAllRESTSubscriptionsFromSdl()
-               if err != nil {
-                       xapp.Logger.Error("%v", err)
-               } else {
-                       c.registry.restSubscriptions = restSubscriptions
-               }
-       */
        return c
 }
 
@@ -431,6 +412,8 @@ func (c *Control) SubscriptionHandler(params interface{}) (*models.SubscriptionR
                return &subResp, nil
        }
 
+       c.WriteRESTSubscriptionToDb(restSubId, restSubscription)
+
        go c.processSubscriptionRequests(restSubscription, &subReqList, p.ClientEndpoint, p.Meid, &restSubId, xAppRmrEndpoint, md5sum)
 
        c.UpdateCounter(cRestSubRespToXapp)