Closed tanner0101 closed 4 years ago
Is this valid Swift?
public static func andAllSync(
_ futures: [@autoclosure () -> EventLoopFuture<Void>],
eventLoop: EventLoop
) -> EventLoopFuture<Void> { }
Looks like no. Bummer because I was thinking about that, too.
Hm. Sounds like an idea to float on the forums...
Overall - this is good. Just some bikeshedding over parameter name and method name.
I'm still trying to resolve what to have the methods be named in SwiftNIO itself with the type of extensions I've been writing for it.
@Mordil I guess this should wait until the bikeshedding is complete with your proposal, then we can make sure this one follows suit with naming.
If you want to jump in and share your thoughts I brought it up on this thread: https://github.com/apple/swift-nio/issues/184#issuecomment-457649370
@tanner0101 It looks like the proposed names of andAll{Succeed | Complete}
and whenAll{Succeed | Complete}
are being accepted in SwiftNIO
EventLoopFutureQueue
can now be used to implement this behavior 👍
Would something like this be useful to add?
The difference to
.andAll
is that each future is not started until the previous one completes. This is useful for things like database migrations where you must not start the next task until the previous is completed.