Skip to content

Commit

Permalink
Merge pull request #1045 from CrowleyRajapakse/master
Browse files Browse the repository at this point in the history
Fixing issues in initial data loading
  • Loading branch information
Krishanx92 authored Jan 19, 2024
2 parents 5763b69 + 7c1e9d9 commit 3e0f726
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions apim-apk-agent/internal/eventhub/dataloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func LoadInitialData(configFile *config.Config) {
data := <-responseChannel
logger.LoggerSync.Info("Receiving subscription data for an environment")
if data.Payload != nil {
logger.LoggerSync.Info("Payload data information received")
logger.LoggerSync.Info("Payload data information received" + string(data.Payload))
retrieveDataFromResponseChannel(data)
break
} else if data.ErrorCode >= 400 && data.ErrorCode < 500 {
Expand Down Expand Up @@ -197,7 +197,11 @@ func LoadInitialData(configFile *config.Config) {
}
}
}
FetchAPIsOnStartUp(conf, apiUUIDList)
if apiUUIDList == nil || len(apiUUIDList) == 0 {
loggers.Info("Empty API List Recieved in fetching")
} else {
FetchAPIsOnStartUp(conf, apiUUIDList)
}
}

// InvokeService invokes the internal data resource
Expand Down Expand Up @@ -232,7 +236,9 @@ func InvokeService(endpoint string, responseType interface{}, queryParamMap map[

// Setting authorization header
req.Header.Set(authorizationHeaderDefault, authorizationBasic+accessToken)
req.Header.Set("x-wso2-tenant", "ALL")
if reflect.TypeOf(responseType) == reflect.TypeOf(types.APIList{}) {
req.Header.Set("x-wso2-tenant", "ALL")
}

// Make the request
//logger.LoggerSubscription.Debug("Sending the request to the control plane over the REST API: " + serviceURL)
Expand Down

0 comments on commit 3e0f726

Please sign in to comment.