Skip to content

Commit

Permalink
Catch and log any exceptions thrown within the executor service
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Baxter committed Aug 16, 2022
1 parent 3be261c commit 17b61c2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,14 @@ protected void onEvent(ConfigMap configMap) {
+ configMap.getMetadata().getName() + " to be published in "
+ k8SConfigurationProperties.getRefreshDelay().toMillis() + " milliseconds");
}
executorService.schedule(() -> triggerRefresh(configMap).subscribe(),
k8SConfigurationProperties.getRefreshDelay().toMillis(), TimeUnit.MILLISECONDS);
executorService.schedule(() -> {
try {
triggerRefresh(configMap).subscribe();
}
catch (Throwable t) {
log.warn("Error when refreshing ConfigMap " + configMap.getMetadata().getName(), t);
}
}, k8SConfigurationProperties.getRefreshDelay().toMillis(), TimeUnit.MILLISECONDS);
}
else {
if (log.isDebugEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,14 @@ protected void onEvent(Secret secret) {
+ " to be published in " + k8SConfigurationProperties.getRefreshDelay().toMillis()
+ " milliseconds");
}
executorService.schedule(() -> triggerRefresh(secret).subscribe(),
k8SConfigurationProperties.getRefreshDelay().toMillis(), TimeUnit.MILLISECONDS);
executorService.schedule(() -> {
try {
triggerRefresh(secret).subscribe();
}
catch (Throwable t) {
log.warn("Error when refreshing ConfigMap " + secret.getMetadata().getName(), t);
}
}, k8SConfigurationProperties.getRefreshDelay().toMillis(), TimeUnit.MILLISECONDS);
}
else {
if (log.isDebugEnabled()) {
Expand Down

0 comments on commit 17b61c2

Please sign in to comment.