Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
belimawr committed Oct 22, 2024
1 parent f03154b commit f3502a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion filebeat/beater/filebeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (fb *Filebeat) setupPipelineLoaderCallback(b *beat.Beat) error {

overwritePipelines := true
b.OverwritePipelinesCallback = func(esConfig *conf.C) error {
ctx, cancel := context.WithCancel(context.Background())
ctx, cancel := context.WithCancel(context.TODO())
defer cancel()
esClient, err := eslegclient.NewConnectedClient(ctx, esConfig, "Filebeat")
if err != nil {
Expand Down
6 changes: 1 addition & 5 deletions heartbeat/beater/heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,7 @@ func New(b *beat.Beat, rawConfig *conf.C) (beat.Beater, error) {
if b.Config.Output.Name() == "elasticsearch" && !b.Manager.Enabled() {
// Connect to ES and setup the State loader if the output is not managed by agent
// Note this, intentionally, blocks until connected or max attempts reached
// TODO(Tiago): I believe this cannot be cancelled here, but all tests are passing
// so I need to fund out the correct life cycle for this connection/context
ctx, cancel := context.WithCancel(context.TODO())
defer cancel()
esClient, err := makeESClient(ctx, b.Config.Output.Config(), 3, 2*time.Second)
esClient, err := makeESClient(context.TODO(), b.Config.Output.Config(), 3, 2*time.Second)
if err != nil {
if parsedConfig.RunOnce {
trace.Abort()
Expand Down

0 comments on commit f3502a3

Please sign in to comment.