Replace `filterWhen` with `flatMap`
This commit is contained in:
parent
2104a60703
commit
7e62dc64dc
|
@ -84,12 +84,11 @@ public class StartPushNotificationExperimentCommand<T> extends AbstractSinglePas
|
||||||
getCommandDependencies().pushNotificationExperimentSamples();
|
getCommandDependencies().pushNotificationExperimentSamples();
|
||||||
|
|
||||||
accounts
|
accounts
|
||||||
.flatMap(account -> Flux.fromIterable(account.getDevices())
|
.flatMap(account -> Flux.fromIterable(account.getDevices()).map(device -> Tuples.of(account, device)))
|
||||||
.map(device -> Tuples.of(account, device)))
|
.doOnNext(ignored -> DEVICE_INSPECTED_COUNTER.increment())
|
||||||
.doOnNext(ignored -> DEVICE_INSPECTED_COUNTER.increment())
|
.flatMap(accountAndDevice -> Mono.fromFuture(() ->
|
||||||
.filterWhen(accountAndDevice -> Mono.fromFuture(() ->
|
experiment.isDeviceEligible(accountAndDevice.getT1(), accountAndDevice.getT2()))
|
||||||
experiment.isDeviceEligible(accountAndDevice.getT1(), accountAndDevice.getT2())),
|
.mapNotNull(eligible -> eligible ? accountAndDevice : null), maxConcurrency)
|
||||||
maxConcurrency)
|
|
||||||
.flatMap(accountAndDevice -> {
|
.flatMap(accountAndDevice -> {
|
||||||
final UUID accountIdentifier = accountAndDevice.getT1().getIdentifier(IdentityType.ACI);
|
final UUID accountIdentifier = accountAndDevice.getT1().getIdentifier(IdentityType.ACI);
|
||||||
final byte deviceId = accountAndDevice.getT2().getId();
|
final byte deviceId = accountAndDevice.getT2().getId();
|
||||||
|
|
Loading…
Reference in New Issue