From c8133c143dcc4bb8a44fb80e0a71c106a65d6a2e Mon Sep 17 00:00:00 2001 From: Aleksandr Maus Date: Thu, 18 Jul 2024 10:09:24 -0400 Subject: [PATCH] Cleanup fleet gateway Run --- .../agent/application/gateway/fleet/fleet_gateway.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/internal/pkg/agent/application/gateway/fleet/fleet_gateway.go b/internal/pkg/agent/application/gateway/fleet/fleet_gateway.go index e028205fd3a..6fde9a590d8 100644 --- a/internal/pkg/agent/application/gateway/fleet/fleet_gateway.go +++ b/internal/pkg/agent/application/gateway/fleet/fleet_gateway.go @@ -130,19 +130,11 @@ func (f *FleetGateway) Actions() <-chan []fleetapi.Action { } func (f *FleetGateway) Run(ctx context.Context) error { - // Backoff implementation doesn't support the use of a context [cancellation] as the shutdown mechanism. - // So we keep a done channel that will be closed when the current context is shutdown. - done := make(chan struct{}) backoff := backoff.NewEqualJitterBackoff( - done, + ctx.Done(), f.settings.Backoff.Init, f.settings.Backoff.Max, ) - go func() { - <-ctx.Done() - close(done) - }() - f.log.Info("Fleet gateway started") for { select {