From 1123a7af3b99883d67b225f6684a203d345e777a Mon Sep 17 00:00:00 2001 From: EddeCCC Date: Fri, 13 Dec 2024 11:07:33 +0100 Subject: [PATCH] add check for timeout isZero() --- .../inspectit/ocelot/core/command/AgentCommandService.java | 2 +- .../config/propertysources/http/HttpConfigurationPoller.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/inspectit-ocelot-core/src/main/java/rocks/inspectit/ocelot/core/command/AgentCommandService.java b/inspectit-ocelot-core/src/main/java/rocks/inspectit/ocelot/core/command/AgentCommandService.java index c9404d2eb5..3ed2dedcea 100644 --- a/inspectit-ocelot-core/src/main/java/rocks/inspectit/ocelot/core/command/AgentCommandService.java +++ b/inspectit-ocelot-core/src/main/java/rocks/inspectit/ocelot/core/command/AgentCommandService.java @@ -123,7 +123,7 @@ private void startScheduledHandler() { handlerFuture = executor.scheduleWithFixedDelay(this, pollingInterval.toMillis(), pollingInterval.toMillis(), TimeUnit.MILLISECONDS); // Setup timeout for fetching a command - if (pollingTimeout != null) + if (pollingTimeout != null && !pollingTimeout.isZero()) timeoutExecutor.scheduleCancelling(handlerFuture, "agentcommand", this::startScheduledHandler, pollingTimeout); } diff --git a/inspectit-ocelot-core/src/main/java/rocks/inspectit/ocelot/core/config/propertysources/http/HttpConfigurationPoller.java b/inspectit-ocelot-core/src/main/java/rocks/inspectit/ocelot/core/config/propertysources/http/HttpConfigurationPoller.java index dd9ad0b7a4..69dbc512b7 100644 --- a/inspectit-ocelot-core/src/main/java/rocks/inspectit/ocelot/core/config/propertysources/http/HttpConfigurationPoller.java +++ b/inspectit-ocelot-core/src/main/java/rocks/inspectit/ocelot/core/config/propertysources/http/HttpConfigurationPoller.java @@ -114,7 +114,7 @@ private void startScheduledPolling() { pollerFuture = executor.scheduleWithFixedDelay(this, pollingInterval.toMillis(), pollingInterval.toMillis(), TimeUnit.MILLISECONDS); // Setup timeout for fetching the configuration - if (pollingTimeout != null) + if (pollingTimeout != null && !pollingTimeout.isZero()) timeoutExecutor.scheduleCancelling(pollerFuture, "http.config", this::startScheduledPolling, pollingTimeout); }