From 6eaa4cf80e007b1ff27c14dade340e3875c97a9c Mon Sep 17 00:00:00 2001
From: Tiago Queiroz <tiago.queiroz@elastic.co>
Date: Fri, 18 Oct 2024 12:09:23 -0400
Subject: [PATCH] PR improvements

---
 CHANGELOG.next.asciidoc       | 15 +--------------
 heartbeat/beater/heartbeat.go |  5 +----
 2 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc
index 9815ef18baae..5988d5bd832f 100644
--- a/CHANGELOG.next.asciidoc
+++ b/CHANGELOG.next.asciidoc
@@ -106,20 +106,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
 - Support Elastic Agent control protocol chunking support {pull}37343[37343]
 - Lower logging level to debug when attempting to configure beats with unknown fields from autodiscovered events/environments {pull}[37816][37816]
 - Set timeout of 1 minute for FQDN requests {pull}37756[37756]
-- Fix the paths in the .cmd script added to the path by the Windows MSI to point to the new C:\Program Files installation location. https://github.com/elastic/elastic-stack-installers/pull/238
-- Change cache processor documentation from `write_period` to `write_interval`. {pull}38561[38561]
-- Fix cache processor expiries heap cleanup on partial file writes. {pull}38561[38561]
-- Fix cache processor expiries infinite growth when large a large TTL is used and recurring keys are cached. {pull}38561[38561]
-- Fix parsing of RFC 3164 process IDs in syslog processor. {issue}38947[38947] {pull}38982[38982]
-- Rename the field "apache2.module.error" to "apache.module.error" in Apache error visualization. {issue}39480[39480] {pull}39481[39481]
-- Validate config of the `replace` processor {pull}40047[40047]
-- Allow port number 0 in the community ID flowhash processor {pull}40259[40259]
-- Fix handling of escaped brackets in syslog structured data. {issue}40445[40445] {pull}40446[40446]
-- Update Go version to 1.22.6. {pull}40528[40528]
-- Aborts all active connections for Elasticsearch output. {pull}40572[40572]
-- Closes beat Publisher on beat stop and by the Agent manager. {pull}40572[40572]
-- The journald input now restarts if there is an error/crash {issue}32782[32782] {pull}40558[40558]
-- Fix Elasticsearch output not recovering from network errors {issue}40705[40705] {pull}40794[40794]
+- Ensure Elasticsearch output can always recover from network errors {pull}40794[40794]
 
 *Auditbeat*
 
diff --git a/heartbeat/beater/heartbeat.go b/heartbeat/beater/heartbeat.go
index e22503ed7413..227b375ee900 100644
--- a/heartbeat/beater/heartbeat.go
+++ b/heartbeat/beater/heartbeat.go
@@ -275,10 +275,7 @@ func (bt *Heartbeat) RunCentralMgmtMonitors(b *beat.Beat) {
 		}
 
 		// Backoff panics with 0 duration, set to smallest unit
-		// TODO(Tiago): find out the correct lifecycle for this context/connection
-		ctx, cancel := context.WithCancel(context.TODO())
-		defer cancel()
-		esClient, err := makeESClient(ctx, outCfg.Config(), 1, 1*time.Nanosecond)
+		esClient, err := makeESClient(context.TODO(), outCfg.Config(), 1, 1*time.Nanosecond)
 		if err != nil {
 			logp.L().Warnf("skipping monitor state management during managed reload: %w", err)
 		} else {