Releases: vapor/async-kit
Finish fixing sequence append for ELFQueue
Previous PR (#54) did not fully fix the problem with appending sequences to EventLoopFutureQueue
. This PR covers the missing bits.
Fix sequence-append in EventLoopFutureQueue
The default behavior of appending to ELFQ is to run the next item on completion of the previous, but the APIs for appending sequences incorrectly assumed the next item is only run on successful completion of the previous.
Don't assert when a future in a queued sequence fails
Currently, if one of the futures appended by EventLoopFutureQueue.append(each:generator:)
fails, we fire an incorrect assertion instead of failing the chain correctly. This PR fixes the issue and adds unit tests.
AsyncKit 1.0.0-beta.2.2
Features:
- Adds a
futureTry
method toEventLoop
that takes in a throwing closure and produces a future with the closure's result. - Adds a
.append(each:_:)
method to theEventLoopFutureQueue
type, which maps each element of the sequence passed in into a future result and then queues the future.
Fixes:
EventLoopFutureQueue
is thread safe now.
AsyncKit 1.0.0-beta.2.1
- Adds an
EventLoopFutureQueue
type (#48).
This type can be used to queue closures that emit EventLoopFuture
s. This allows you to ensure that a given future will not be run until the previous ones complete, succeed, or fail, depending on the condition you set.
AsyncKit 1.0.0 Beta 2
- Separated
ConnectionPool
into two components:EventLoopGroupConnectionPool
andEventLoopConnectionPool
(#42)
This change greatly reduces code complexity by breaking out the old ConnectionPool
's behavior into distinct components. It also increases usability, allowing developers to choose which functionality they want to use.
EventLoopGroupConnectionPool
: Maintains one EventLoopConnectionPool
per EventLoop
on the supplied EventLoopGroup
. Use this if you are in a global, thread-safe context. This is great for application's that use wait()
, classes that do EL-synchronization internally, or shared pools that want each event loop to have its own collection of pools. This class is thread-safe.
EventLoopConnectionPool
: A pool of connections that is tied to a single event loop.
If you have an EventLoopGroupConnectionPool
, you can get an individual EventLoop
's pool by doing groupPool.pool(for: eventLoop)
. This class is not thread-safe and must always be used from the associated EventLoop
.
-
Custom
Logger
s are now passable anywhere logging occurs. -
Enabled test discovery on Linux (#46)
AsyncKit 1.0.0 Beta 1
ConnectionPool
can now be shared across anEventLoopGroup
. (#40)
Notes:
ConnectionPool
is now based on anEventLoopGroup
and has aConnectionPoolEventLoopPreference
enum for informing the pool whichEventLoop
you would like to be called back on.ConnectionPool
can still be used on a singleEventLoop
, this change just expands its applicability to more use cases.
ConnectionPool
can now prune old, closed connections when resource demand is low. (#41)
AsyncKit 1.0.0 Alpha 1
More information on Vapor 4 alpha releases:
https://medium.com/@codevapor/vapor-4-alpha-1-releases-begin-94a4bc79dd9a
API Docs:
https://api.vapor.codes/async-kit/master/AsyncKit/index.html
v0.1.0
EventLoopFuture Operators
Adds standard operators to future types, so if you have for example, two EventLoopFuture<Int>
, you can add them together:
let future1 = eventLoop.future(1)
let future2 = eventLoop.future(2)
let future3 = future1 + future2
Here's a list of all the operators:
+
+=
-
-=
*
*=
%
%=
&
&=
/
/=
>
>=
<
<=
<<
<<=
>>
>>=
^
^=
|
|=
~