diff --git a/x-pack/elastic-agent/pkg/agent/application/handler_action_policy_change.go b/x-pack/elastic-agent/pkg/agent/application/handler_action_policy_change.go index a52a37c89301..76bdf4c0caca 100644 --- a/x-pack/elastic-agent/pkg/agent/application/handler_action_policy_change.go +++ b/x-pack/elastic-agent/pkg/agent/application/handler_action_policy_change.go @@ -25,6 +25,10 @@ import ( "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/kibana" ) +const ( + apiStatusTimeout = 15 * time.Second +) + type clientSetter interface { SetClient(clienter) } @@ -100,7 +104,7 @@ func (h *handlerPolicyChange) handleKibanaHosts(ctx context.Context, c *config.C err, "fail to create API client with updated hosts", errors.TypeNetwork, errors.M("hosts", h.config.Fleet.Kibana.Hosts)) } - ctx, cancel := context.WithTimeout(ctx, 15*time.Second) + ctx, cancel := context.WithTimeout(ctx, apiStatusTimeout) defer cancel() _, err = client.Send(ctx, "GET", "/api/status", nil, nil, nil) if err != nil {