Fixed bug: Delay was not not getting trigerred during config query Re-try 04/6204/1
authorwahidw <abdulwahid.w@nokia.com>
Wed, 2 Jun 2021 14:30:35 +0000 (14:30 +0000)
committerwahidw <abdulwahid.w@nokia.com>
Wed, 2 Jun 2021 14:30:35 +0000 (14:30 +0000)
Signed-off-by: wahidw <abdulwahid.w@nokia.com>
Change-Id: I27a3a10739c2790b5a92512297571d735b8724fc

pkg/restful/restful.go

index c911895..e6bebb7 100755 (executable)
@@ -210,6 +210,7 @@ func httpGetXAppsconfig(url string) *string {
        appmgr.Logger.Info("Invoked httprestful.httpGetXApps: " + url)
        resp, err := http.Get(url)
        if err != nil {
+               appmgr.Logger.Error("Error while querying config to Xapp: ", err.Error())
                return nil
        }
        defer resp.Body.Close()
@@ -320,7 +321,6 @@ func (r *Restful) PrepareConfig(params models.RegisterRequest, updateflag bool)
                if xappconfig != nil {
                        data := parseConfig(xappconfig)
                        if data != nil {
-                               appmgr.Logger.Info("iRetry Count = %v", i)
                                var xapp models.Xapp
 
                                xapp.Name = params.AppName
@@ -336,8 +336,9 @@ func (r *Restful) PrepareConfig(params models.RegisterRequest, updateflag bool)
                        if configPresent == true {
                                break
                        }
-                       time.Sleep(2 * time.Second)
                }
+               appmgr.Logger.Info("Retrying query configuration from xapp, try no : %d", i)
+               time.Sleep(4 * time.Second)
        }
        return nil, errors.New("Unable to get configmap after 5 retries")
 }
@@ -432,9 +433,9 @@ func (r *Restful) symptomdataServer() {
        http.HandleFunc("/ric/v1/symptomdata", func(w http.ResponseWriter, req *http.Request) {
                d, _ := r.GetApps()
                xappData := struct {
-                       XappList                models.AllDeployedXapps `json:"xappList"`
-                       ConfigList              models.AllXappConfig    `json:"configList"`
-                       SubscriptionList        models.AllSubscriptions `json:"subscriptionList"`
+                       XappList         models.AllDeployedXapps `json:"xappList"`
+                       ConfigList       models.AllXappConfig    `json:"configList"`
+                       SubscriptionList models.AllSubscriptions `json:"subscriptionList"`
                }{
                        d,
                        r.getAppConfig(),