Skip to content

Commit

Permalink
fix unparam issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristina Pathak committed Sep 21, 2022
1 parent 7caefe6 commit d699748
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions cmd/otel-allocator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,7 @@ func main() {
os.Exit(1)
}

srv, err := newServer(log, allocator, discoveryManager, k8sclient, cliConf.ListenAddr)
if err != nil {
setupLog.Error(err, "Can't start the server")
}
srv := newServer(log, allocator, discoveryManager, k8sclient, cliConf.ListenAddr)

interrupts := make(chan os.Signal, 1)
signal.Notify(interrupts, os.Interrupt, syscall.SIGTERM)
Expand Down Expand Up @@ -128,10 +125,7 @@ func main() {
if err := srv.Shutdown(ctx); err != nil {
setupLog.Error(err, "Cannot shutdown the server")
}
srv, err = newServer(log, allocator, discoveryManager, k8sclient, cliConf.ListenAddr)
if err != nil {
setupLog.Error(err, "Error restarting the server with new config")
}
srv = newServer(log, allocator, discoveryManager, k8sclient, cliConf.ListenAddr)
go func() {
if err := srv.Start(); err != http.ErrServerClosed {
setupLog.Error(err, "Can't restart the server")
Expand Down Expand Up @@ -163,7 +157,7 @@ type server struct {
server *http.Server
}

func newServer(log logr.Logger, allocator allocation.Allocator, discoveryManager *lbdiscovery.Manager, k8sclient *collector.Client, listenAddr *string) (*server, error) {
func newServer(log logr.Logger, allocator allocation.Allocator, discoveryManager *lbdiscovery.Manager, k8sclient *collector.Client, listenAddr *string) *server {
s := &server{
logger: log,
allocator: allocator,
Expand All @@ -176,7 +170,7 @@ func newServer(log logr.Logger, allocator allocation.Allocator, discoveryManager
router.HandleFunc("/jobs/{job_id}/targets", s.TargetsHandler).Methods("GET")
router.Path("/metrics").Handler(promhttp.Handler())
s.server = &http.Server{Addr: *listenAddr, Handler: router, ReadHeaderTimeout: 90 * time.Second}
return s, nil
return s
}

func configureFileDiscovery(log logr.Logger, allocator allocation.Allocator, discoveryManager *lbdiscovery.Manager, ctx context.Context, cliConfig config.CLIConfig) (*collector.Client, error) {
Expand Down

0 comments on commit d699748

Please sign in to comment.