Skip to content

Commit

Permalink
Bug Fix 103 (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
q131172019 authored Aug 11, 2022
1 parent 75a0891 commit e7d44db
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion resource-management/cmds/service-api/service-api.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ package main
import (
"flag"
"fmt"
"k8s.io/klog/v2"
"os"
"strings"
"time"

"k8s.io/klog/v2"

"global-resource-service/resource-management/cmds/service-api/app"
localMetrics "global-resource-service/resource-management/pkg/common-lib/metrics"
)
Expand Down Expand Up @@ -52,9 +53,22 @@ func main() {
os.Exit(1)
}

// Trim any leading or trailing "," seperators
// Fix bug #103
urls = strings.TrimLeft(urls, ",")
urls = strings.TrimRight(urls, ",")

localMetrics.SetEnableResourceManagementMeasurement(metricsEnabled)
c.ResourceUrls = strings.Split(urls, ",")

// Check whether c.ResourceUrls contains invaild urls
for _, url := range c.ResourceUrls {
if url == "" {
klog.Errorf("Error: resource url is missing or wrong input when input --resource_urls")
os.Exit(1)
}
}

// keep a more frequent flush frequency as 1 second
klog.StartFlushDaemon(time.Second * 1)

Expand Down

0 comments on commit e7d44db

Please sign in to comment.