Skip to content

Commit

Permalink
remove timeout from default config
Browse files Browse the repository at this point in the history
  • Loading branch information
EddeCCC committed Dec 13, 2024
1 parent 0a2276b commit 29ee5aa
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ inspectit:
polling-interval: 15s
# the time to keep an HTTP connection alive
time-to-live: 4m
# the maximum time to run one agent command polling task - set to 0s to disable
task-timeout: 32m
# how long the agent will stay in the live mode, before falling back to the normal mode
live-mode-duration: 2m
retry:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ inspectit:
enabled: true
# the frequency of polling the http endpoint to check for configuration changes
frequency: 30s
# the maximum time to run one http polling task - set to 0s to disable timeout
task-timeout: 64m
# the following attributes will be sent as http query parameters when fetching the configuration
attributes:
service: ${inspectit.service-name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private void startScheduledHandler() {
handlerFuture = executor.scheduleWithFixedDelay(this,
pollingInterval.toMillis(), pollingInterval.toMillis(), TimeUnit.MILLISECONDS);
// Setup timeout for fetching a command
if (!pollingTimeout.isZero())
if (pollingTimeout != null)
timeoutExecutor.scheduleCancelling(handlerFuture, "agentcommand", this::startScheduledHandler, pollingTimeout);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private void startScheduledPolling() {
pollerFuture = executor.scheduleWithFixedDelay(this,
pollingInterval.toMillis(), pollingInterval.toMillis(), TimeUnit.MILLISECONDS);
// Setup timeout for fetching the configuration
if (!pollingTimeout.isZero())
if (pollingTimeout != null)
timeoutExecutor.scheduleCancelling(pollerFuture, "http.config", this::startScheduledPolling, pollingTimeout);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,7 @@ void shouldNotCancelFutureWhenNoTimeout() throws MalformedURLException {

@Test
void shouldNotCancelFutureWhenTimeoutIsZero() throws MalformedURLException {
Duration timeout = Duration.ofMillis(0);
when(configuration.getAgentCommands().getPollingInterval()).thenReturn(Duration.ofMillis(500));
when(configuration.getAgentCommands().getTaskTimeout()).thenReturn(timeout);
when(configuration.getAgentCommands().getUrl()).thenReturn(new URL("http://example.org"));
ScheduledFuture future = mock(ScheduledFuture.class);
when(executor.scheduleWithFixedDelay(any(Runnable.class), anyLong(), anyLong(), any(TimeUnit.class))).thenReturn(future);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,10 @@ void shouldNotCancelFutureWhenNoTimeout() {

@Test
void shouldNotCancelFutureWhenTimeoutIsZero() {
Duration timeout = Duration.ofMillis(0);
InspectitConfig configuration = new InspectitConfig();
configuration.setConfig(new ConfigSettings());
configuration.getConfig().setHttp(new HttpConfigSettings());
configuration.getConfig().getHttp().setFrequency(Duration.ofMillis(500));
configuration.getConfig().getHttp().setTaskTimeout(timeout);
ScheduledFuture future = Mockito.mock(ScheduledFuture.class);
when(executor.scheduleWithFixedDelay(any(Runnable.class), anyLong(), anyLong(), any(TimeUnit.class))).thenReturn(future);

Expand Down

0 comments on commit 29ee5aa

Please sign in to comment.