Skip to content

Commit

Permalink
minor: remove unused endpointRegistry field from healthyEndpoints and…
Browse files Browse the repository at this point in the history
… fadeIn (#3248)

Signed-off-by: Roman Zavodskikh <roman.zavodskikh@zalando.de>
  • Loading branch information
RomanZavodskikh authored Sep 25, 2024
1 parent 1db1ac7 commit 2e9e3cf
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 7 deletions.
3 changes: 1 addition & 2 deletions proxy/fadein.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import (
)

type fadeIn struct {
rnd *rand.Rand
endpointRegistry *routing.EndpointRegistry
rnd *rand.Rand
}

func (f *fadeIn) fadeInScore(lifetime time.Duration, duration time.Duration, exponent float64) float64 {
Expand Down
2 changes: 1 addition & 1 deletion proxy/fadein_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func initializeEndpoints(endpointAges []float64, algorithmName string, fadeInDur
registry.GetMetrics(eps[i]).SetDetected(detectionTimes[i])
}

proxy := &Proxy{registry: registry, fadein: &fadeIn{rnd: rand.New(loadbalancer.NewLockedSource()), endpointRegistry: registry}, quit: make(chan struct{})}
proxy := &Proxy{registry: registry, fadein: &fadeIn{rnd: rand.New(loadbalancer.NewLockedSource())}, quit: make(chan struct{})}
return route, proxy, eps
}

Expand Down
1 change: 0 additions & 1 deletion proxy/healthy_endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

type healthyEndpoints struct {
rnd *rand.Rand
endpointRegistry *routing.EndpointRegistry
maxUnhealthyEndpointsRatio float64
}

Expand Down
4 changes: 1 addition & 3 deletions proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -841,16 +841,14 @@ func WithParams(p Params) *Proxy {
if p.EnablePassiveHealthCheck {
healthyEndpointsChooser = &healthyEndpoints{
rnd: rand.New(loadbalancer.NewLockedSource()),
endpointRegistry: p.EndpointRegistry,
maxUnhealthyEndpointsRatio: p.PassiveHealthCheck.MaxUnhealthyEndpointsRatio,
}
}
return &Proxy{
routing: p.Routing,
registry: p.EndpointRegistry,
fadein: &fadeIn{
rnd: rand.New(loadbalancer.NewLockedSource()),
endpointRegistry: p.EndpointRegistry,
rnd: rand.New(loadbalancer.NewLockedSource()),
},
heathlyEndpoints: healthyEndpointsChooser,
roundTripper: p.CustomHttpRoundTripperWrap(tr),
Expand Down

0 comments on commit 2e9e3cf

Please sign in to comment.