Skip to content

Commit

Permalink
HSEARCH-4134 Catch and log any error/exception of background process
Browse files Browse the repository at this point in the history
  • Loading branch information
fax4ever committed Mar 31, 2021
1 parent 4ad4828 commit 6f60ef6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Expand Up @@ -333,4 +333,8 @@ SearchException foundMultipleEntitiesForDocumentId(String entityName, String doc
@Message(id = ID_OFFSET + 52, value = "Reindex of outbox entities failed. Outbox entities : '%1$s'.")
void failureToReindexOutboxEntities(List<EntityReference> entities, @Cause Throwable t);

@LogMessage(level = ERROR)
@Message(id = ID_OFFSET + 53, value = "There are some failure on the background process of outbox entities.")
void failureOnOutboxBackgroundProcessing(@Cause Throwable t);

}
Expand Up @@ -48,7 +48,14 @@ public OutboxEventBackgroundExecutor(AutomaticIndexingMappingContext mapping, Sc
}

public void start() {
executor.scheduleAtFixedRate( this::run, 0, pollingInterval, TimeUnit.MILLISECONDS );
executor.scheduleAtFixedRate( () -> {
try {
run();
}
catch (Throwable throwable) {
log.failureOnOutboxBackgroundProcessing( throwable );
}
}, 0, pollingInterval, TimeUnit.MILLISECONDS );
}

public CompletableFuture<?> stop() {
Expand Down

0 comments on commit 6f60ef6

Please sign in to comment.