Use Mono.fromFuture(() ->) instead of Mono.fromFuture() to defer

evaluation
This commit is contained in:
Ameya Lokare committed 2026-07-17 10:53:44 -07:00
1 parent 607c839dda
commit 4410da5fb2
1 file changed
+1 -1
@@ -129,7 +129,7 @@ public class FoundationDbMessageStream implements MessageStream {
final List<Database> databases = Arrays.stream(databasesByEpoch).filter(Objects::nonNull).distinct().toList();
return Flux.fromIterable(databases)
.flatMap(database -> Mono.fromFuture(getEndOfQueueKeyExclusive(database))
.flatMap(database -> Mono.fromFuture(() -> getEndOfQueueKeyExclusive(database))
.map(maybeEndOfQueueKeyExclusive -> Tuples.of(database, maybeEndOfQueueKeyExclusive)))
.collectMap(Tuple2::getT1, Tuple2::getT2)
.flatMapMany(endOfQueueKeysByDatabase -> {