Use flatMapIterable when possible

This commit is contained in:
Andrea Cavalli 2021-07-31 18:01:20 +02:00
parent a840df8ed3
commit 21097c5135
1 changed files with 2 additions and 2 deletions

View File

@ -78,11 +78,11 @@ public class BinlogUtils {
.rxReadFile(binlogPath.toString()).as(MonoUtils::toMono)
.flatMap(buffer -> vertxFilesystem
.rxReadDir(sessionPath.toString(), "^(?!td.binlog$).*").as(MonoUtils::toMono)
.flatMapMany(Flux::fromIterable)
.flatMapIterable(list -> list)
.doOnNext(file -> logger.debug("Deleting session file {}", file))
.flatMap(file -> vertxFilesystem.rxDeleteRecursive(file, true).as(MonoUtils::toMono))
.then(vertxFilesystem.rxReadDir(mediaPath.toString(), "^(?!td.binlog$).*").as(MonoUtils::toMono))
.flatMapMany(Flux::fromIterable)
.flatMapIterable(list -> list)
.doOnNext(file -> logger.debug("Deleting media file {}", file))
.flatMap(file -> vertxFilesystem.rxDeleteRecursive(file, true).as(MonoUtils::toMono))
.onErrorResume(ex -> Mono.empty())