Skip to content

Commit

Permalink
Cleanup fleet gateway Run (#5169)
Browse files Browse the repository at this point in the history
Co-authored-by: Pierre HILBERT <pierre.hilbert@elastic.co>
  • Loading branch information
aleksmaus and pierrehilbert authored Jul 23, 2024
1 parent 2ff1cd6 commit 3f363ff
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions internal/pkg/agent/application/gateway/fleet/fleet_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 3f363ff

Please sign in to comment.