Swiftpack.co - Package - vapor/async-kit

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.


Sugary extensions for the SwiftNIO library


Stars: 42
Last commit: 7 weeks ago


Add "sequenced" variants of flatMapEach() and flatMapEachCompact() - 2020-12-01T14:14:58

This patch was authored and released by @gwynne.

These new variants guarantee two specific behaviors:

  1. The futures returned for each element of the iterated sequence will be executed singularly and strictly in order. Only one will run at a time, and the order in which they run will match that returned by the transformation callback.

  2. If any one of the futures should fail, no other futures will begin execution, even if they were ready to do so.

Additional changes:

  • Added new tests for the "sequenced" behaviors,
  • Made sure the ELG used for the collections+futures tests has multiple threads, otherwise the tests are meaningless.
  • Fixed a couple of typos in comments.
  • Simplified the implementations of the original flatMapEach(on:_:) and flatMapEachCompact(on:_:) (no functional changes).