Skip to content

Commit

Permalink
Replace AsyncBackpressuredStream with updated implementation (#29)
Browse files Browse the repository at this point in the history
### Motivation

As a follow up to #27, we noted it would be good to align on the latest
draft implementation of SE-0406 (AsyncStream with backpressure) to both
pickup the latest improvements in performance and correctness, and to
minimise the churn if/when this lands in the standard library or
standalone package.

### Modifications

In order to simplify reviewing the following modifications have been
made in independent commits:

* `Add updated SE-0406 implementation as BufferedStream, incl. tests`:
Skim over this—it's vendored in wholesale.
* `Port the custom watermark support to BufferedStream`: Skim over
this—it's a 1:1 port of the logic that was added to
`AsyncBackpressuredStream`.
* `Switch from AsyncBackpressuredStream to BufferedStream in delegate`:
Review this—it's a minimal change.
* `Remove AsyncBackpressuredStream and its vendored locks`: Skim over
this—it's removing the old implementation.

### Result

No functional change, but the internal async sequence we're using should
be more robust, performant, and more likely to match a future standard
library type.

### Test Plan

- The new vendored `BufferedStream` actually comes with a much greater
number of vendored tests than the previous revision.
- Also ported the tests from this repo for the custom watermark logic.
- All our URLSessionTransport-specific tests continue to pass.

---------

Signed-off-by: Si Beaumont <beaumont@apple.com>
  • Loading branch information
simonjbeaumont committed Nov 23, 2023
1 parent 8c84285 commit 9229842
Show file tree
Hide file tree
Showing 8 changed files with 3,451 additions and 1,975 deletions.

This file was deleted.

213 changes: 0 additions & 213 deletions Sources/OpenAPIURLSession/AsyncBackpressuredStream/NIOLock.swift

This file was deleted.

0 comments on commit 9229842

Please sign in to comment.