Details
-
Task
-
Resolution: Won't Fix
-
Major - P3
-
None
-
None
-
None
-
None
-
Service Arch 2022-08-08, Service Arch 2022-08-22
Description
Right now, we have a helper function future_util::whenAny that takes as argument a vector of Future<T> and returns a SemiFuture that resolves when the first of the input futures resolves along with its index in the input vector.
This function is useful but doesn't allow for any selectivity about how the input futures resolve. For example, we might want a future that resolves when any of the input futures resolve with success, i.e. whenAnySucceeds. To allow for that sort of selectivity, add a whenAnyThat helper that takes a predicate to evaluate against each result of the input futures and only resolves the output future when either:
-> one of the input futures resolves with a result that satisfies the predicate
-> all of the input futures resolve