Skip to content

Commit

Permalink
thread interrupted
Browse files Browse the repository at this point in the history
  • Loading branch information
lastpeony committed Oct 28, 2024
1 parent b9dd4c7 commit 3b29385
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
6 changes: 4 additions & 2 deletions src/main/java/io/antmedia/AntMediaApplicationAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,8 @@ public boolean retrySendClusterPostWithDelay(String url, String clusterCommunica
// Timeout for each retry = retry delay + request timeout + buffer
return future.get(appSettings.getWebhookRetryDelay() + CLUSTER_POST_TIMEOUT_MS + 500, TimeUnit.MILLISECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
logger.error("Error waiting for retry POST request completion", e);
logger.error(ExceptionUtils.getStackTrace(e));
Thread.currentThread().interrupt();
return false;
}
}
Expand Down Expand Up @@ -1415,7 +1416,8 @@ public boolean forwardStartStreaming(Broadcast broadcast) {
long totalTimeout = CLUSTER_POST_RETRY_ATTEMPT * (appSettings.getWebhookRetryDelay() + 1000) + 1000;
return future.get(totalTimeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
logger.error("Error waiting for Cluster POST request completion", e);
logger.error(ExceptionUtils.getStackTrace(e));
Thread.currentThread().interrupt();
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2132,18 +2132,6 @@ public void testSendClusterPost() throws Exception {

boolean result6 = spyAdapter.retrySendClusterPostWithDelay(testUrl, testToken, 1);
assertFalse(result6);

// Test Case 7: Test retrySendClusterPostWithDelay success
CompletableFuture<Boolean> successFuture = new CompletableFuture<>();
Mockito.doAnswer(invocation -> {
successFuture.complete(true);
return true;
}).when(spyAdapter).sendClusterPost(eq(testUrl), eq(testToken), eq(1));

boolean result7 = spyAdapter.retrySendClusterPostWithDelay(testUrl, testToken, 1);
assertTrue(result7);

verify(httpClient, atLeastOnce()).close();
}

@Test
Expand Down

0 comments on commit 3b29385

Please sign in to comment.