Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

Commit

Permalink
fix(monitor): Probe check must be done from a dedicated thread to avo…
Browse files Browse the repository at this point in the history
…id blocked event-loop thread

Closes gravitee-io/issues#2125
  • Loading branch information
brasseld authored and NicolasGeraud committed Apr 12, 2019
1 parent 87c9826 commit 9f62bb0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
Expand Up @@ -39,11 +39,17 @@ public String id() {

@Override
public CompletableFuture<Result> check() {
// Search for an event to check repository connection
try {
eventRepository.search(new EventCriteria.Builder()
.from(System.currentTimeMillis()).to(System.currentTimeMillis()).build());
return CompletableFuture.completedFuture(Result.healthy());
// Search for an event to check repository connection
return CompletableFuture.supplyAsync(() -> {
try {
eventRepository.search(new EventCriteria.Builder()
.from(System.currentTimeMillis()).to(System.currentTimeMillis()).build());
return Result.healthy();
} catch (Exception ex) {
return Result.unhealthy(ex);
}
});
} catch (Exception ex) {
return CompletableFuture.completedFuture(Result.unhealthy(ex));
}
Expand Down
Expand Up @@ -40,10 +40,16 @@ public String id() {

@Override
public CompletableFuture<Result> check() {
// Search for a rate-limit value to check repository connection
try {
rateLimitRepository.get(RATE_LIMIT_UNKNOWN_IDENTIFIER);
return CompletableFuture.completedFuture(Result.healthy());
// Search for a rate-limit value to check repository connection
return CompletableFuture.supplyAsync(() -> {
try {
rateLimitRepository.get(RATE_LIMIT_UNKNOWN_IDENTIFIER);
return Result.healthy();
} catch (Exception ex) {
return Result.unhealthy(ex);
}
});
} catch (Exception ex) {
return CompletableFuture.completedFuture(Result.unhealthy(ex));
}
Expand Down

0 comments on commit 9f62bb0

Please sign in to comment.