From d0ab10b6088c926fad40645dc1c3e4334144756f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Can=CC=83ete?= Date: Mon, 7 Nov 2022 22:16:11 +0100 Subject: [PATCH] chore: remove unnecessary variable --- pkg/scalers/nats_jetstream_scaler.go | 4 +--- pkg/scalers/stan_scaler.go | 6 ++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/pkg/scalers/nats_jetstream_scaler.go b/pkg/scalers/nats_jetstream_scaler.go index 1d085a1b411..f68f57fdf4e 100644 --- a/pkg/scalers/nats_jetstream_scaler.go +++ b/pkg/scalers/nats_jetstream_scaler.go @@ -173,9 +173,7 @@ func getNATSJetStreamEndpoint(useHTTPS bool, natsServerEndpoint string, account } func (s *natsJetStreamScaler) IsActive(ctx context.Context) (bool, error) { - monitoringEndpoint := s.metadata.monitoringEndpoint - - req, err := http.NewRequestWithContext(ctx, http.MethodGet, monitoringEndpoint, nil) + req, err := http.NewRequestWithContext(ctx, http.MethodGet, s.metadata.monitoringEndpoint, nil) if err != nil { return false, err } diff --git a/pkg/scalers/stan_scaler.go b/pkg/scalers/stan_scaler.go index c93ebed7046..fc8cf697bb4 100644 --- a/pkg/scalers/stan_scaler.go +++ b/pkg/scalers/stan_scaler.go @@ -142,9 +142,7 @@ func parseStanMetadata(config *ScalerConfig) (stanMetadata, error) { // IsActive determines if we need to scale from zero func (s *stanScaler) IsActive(ctx context.Context) (bool, error) { - monitoringEndpoint := s.metadata.monitoringEndpoint - - req, err := http.NewRequestWithContext(ctx, "GET", monitoringEndpoint, nil) + req, err := http.NewRequestWithContext(ctx, "GET", s.metadata.monitoringEndpoint, nil) if err != nil { return false, err } @@ -165,7 +163,7 @@ func (s *stanScaler) IsActive(ctx context.Context) (bool, error) { } defer baseResp.Body.Close() if baseResp.StatusCode == 404 { - s.logger.Info("Streaming broker endpoint returned 404. Please ensure it has been created", "url", monitoringEndpoint, "channelName", s.metadata.subject) + s.logger.Info("Streaming broker endpoint returned 404. Please ensure it has been created", "url", s.metadata.monitoringEndpoint, "channelName", s.metadata.subject) } else { s.logger.Info("Unable to connect to STAN. Please ensure you have configured the ScaledObject with the correct endpoint.", "baseResp.StatusCode", baseResp.StatusCode, "monitoringEndpoint", s.metadata.monitoringEndpoint) }