Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continue to make forward progress when cancelled #261

Merged
merged 4 commits into from
Mar 18, 2022

Conversation

fabianfett
Copy link
Collaborator

Motivation

With the async/await interface we introduced the option to ignore a rowStream (by dropping the AsyncSequence or AsyncIterator). In those cases we must fail the stream and drain the connection ASAP. Otherwise we will lock up the connection.

Changes

  • Drain connection, if the row stream was cancelled

Result

Connection is reusable, even if previous queries were cancelled.

Note:

Needs more unit tests

@codecov-commenter
Copy link

codecov-commenter commented Mar 13, 2022

Codecov Report

Merging #261 (3e900c8) into main (ab624e4) will increase coverage by 0.72%.
The diff coverage is 60.83%.

@@            Coverage Diff             @@
##             main     #261      +/-   ##
==========================================
+ Coverage   43.85%   44.57%   +0.72%     
==========================================
  Files         115      115              
  Lines        9513     9639     +126     
==========================================
+ Hits         4172     4297     +125     
- Misses       5341     5342       +1     
Flag Coverage Δ
unittests 44.57% <60.83%> (+0.72%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
Sources/PostgresNIO/Postgres+PSQLCompat.swift 0.00% <0.00%> (ø)
...urces/PostgresNIO/New/PostgresChannelHandler.swift 61.14% <18.18%> (-0.45%) ⬇️
...nnection State Machine/RowStreamStateMachine.swift 66.85% <58.69%> (-2.92%) ⬇️
...tion State Machine/ExtendedQueryStateMachine.swift 68.57% <64.28%> (+3.30%) ⬆️
...nection State Machine/ConnectionStateMachine.swift 57.54% <90.90%> (+2.88%) ⬆️
Sources/PostgresNIO/New/PSQLError.swift 76.31% <100.00%> (+0.97%) ⬆️
...rces/PostgresNIO/New/Extensions/Logging+PSQL.swift 22.72% <0.00%> (+3.11%) ⬆️

@fabianfett fabianfett requested a review from gwynne March 16, 2022 11:25
@fabianfett fabianfett marked this pull request as ready for review March 16, 2022 11:25
@fabianfett fabianfett added this to the 1.9.0 milestone Mar 16, 2022
Copy link
Member

@gwynne gwynne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two utterly pointless grammar nits just to annoy you 🙂, plus one minor functional nit, marking as changes requested in case there was an actual logic error there.

Co-authored-by: Gwynne Raskind <gwynne@darkrainfall.org>
Copy link
Member

@gwynne gwynne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad on the misread, approved!

@fabianfett fabianfett enabled auto-merge (squash) March 18, 2022 09:46
@fabianfett fabianfett merged commit c1683ba into vapor:main Mar 18, 2022
@fabianfett fabianfett deleted the ff-read-when-cancelled branch March 18, 2022 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants