Skip to content

Commit

Permalink
JAMES-3784 EmptyErrorMailRepositoryHealthCheck support sizeReactive
Browse files Browse the repository at this point in the history
  • Loading branch information
vttranlina committed Jul 7, 2022
1 parent c92f7cc commit 9f0d7c2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public ComponentName componentName() {

@Override
public Mono<Result> check() {
// TODO: use .sizeReactive of https://github.com/apache/james-project/pull/1049/
return Flux.fromStream(Throwing.supplier(() -> repositoryStore.getByPath(errorRepositoryPath)))
.any(Throwing.predicate(repository -> repository.size() > 0))
.flatMap(MailRepository::sizeReactive)
.any(repositorySize -> repositorySize > 0)
.filter(FunctionalUtils.identityPredicate())
.map(hasSize -> Result.degraded(COMPONENT_NAME, "MailRepository is not empty"))
.switchIfEmpty(Mono.just(Result.healthy(COMPONENT_NAME)));
Expand Down

0 comments on commit 9f0d7c2

Please sign in to comment.