Skip to content

Commit

Permalink
Fix warning messages in config.go and client.go
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-github-robot authored Feb 4, 2025
2 parents e7c4d66 + ee75657 commit 00b5fd6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/core/common/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func limitConcurrentRequests(requestKey string, limit int) bool {
currentCount := count.(int)

if currentCount >= limit {
fmt.Printf("[%s] requests for %s \n", currentCount, requestKey)
fmt.Printf("[%d] requests for %s \n", currentCount, requestKey)
return false
}

Expand Down
10 changes: 4 additions & 6 deletions src/core/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,31 +248,29 @@ func GetConfig(id string) (model.ConfigInfo, error) {
res := model.ConfigInfo{}

check, err := CheckConfig(id)
errString := id + " config is not found from Key-value store. Envirionment variable will be used."

if !check {
err := fmt.Errorf(errString)
err = fmt.Errorf("config '%s' not found in key-value store: no configuration data exists, will fallback to environment variables", id)
return res, err
}

if err != nil {
err := fmt.Errorf(errString)
err := fmt.Errorf("failed to check config '%s': configuration validation error - %v", id, err)
return res, err
}

key := "/config/" + id

keyValue, err := kvstore.GetKv(key)
if err != nil {
err := fmt.Errorf(errString)
err := fmt.Errorf("failed to retrieve config '%s' from key-value store: %v (path: %s)", id, err, key)
return res, err
}

log.Debug().Msg("<" + keyValue.Key + "> " + keyValue.Value)

err = json.Unmarshal([]byte(keyValue.Value), &res)
if err != nil {
err := fmt.Errorf(errString)
err := fmt.Errorf("failed to parse config '%s': invalid JSON format in key-value store - %v (raw value: %s)", id, err, keyValue.Value)
return res, err
}
return res, nil
Expand Down

0 comments on commit 00b5fd6

Please sign in to comment.