do not call agent.converge_state_and_update before agent.execute

This commit is contained in:
Colin Surprenant 2020-06-17 17:22:30 -04:00
parent c2e4e4f185
commit 40a807d4e6
2 changed files with 14 additions and 2 deletions

View file

@ -162,6 +162,18 @@ class LogStash::Agent
@running.false? @running.false?
end end
# Only call converge_state_and_update if agent is running
# to avoid a double call to converge_state_and_update since
# agent.execute will call converge_state_and_update itself
def converge_state_and_update_if_running
converge_state_and_update if running?
end
# Trigger convergence of pipelines
# NOTE that there is no point of calling this method before
# Agent#execute has been called since it will itself call
# converge_state_and_update and will result in a double
# convergence.
def converge_state_and_update def converge_state_and_update
results = @source_loader.fetch results = @source_loader.fetch

View file

@ -35,7 +35,7 @@ module LogStash module Monitoring
super(xpack_info) if xpack_info super(xpack_info) if xpack_info
if valid_basic_license? if valid_basic_license?
logger.info("Validated license for monitoring. Enabling monitoring pipeline.") logger.info("Validated license for monitoring. Enabling monitoring pipeline.")
enable_monitoring() enable_monitoring
end end
end end
@ -45,7 +45,7 @@ module LogStash module Monitoring
end end
def enable_monitoring def enable_monitoring
@agent.converge_state_and_update @agent.converge_state_and_update_if_running
end end
def populate_license_state(xpack_info) def populate_license_state(xpack_info)