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

Combine RequestBody delegate, source state to fix hang #666

Merged
merged 8 commits into from
Jan 29, 2025

Conversation

adam-fowler
Copy link
Member

@adam-fowler adam-fowler commented Jan 27, 2025

The waitingForProduceMore continuations and the produceMore state have been combined into one state in the Delegate of RequestBody,

Fixes issue with hang where yield was told to stop producing and but then was told it could continue producing before the next call to yield.

An alternative solution, which is simpler, would be to wait on the continuation as soon as yield returns stopProducing but this means Source.yield() stalls on the yield that returns stop producing and not the next yield.

…to single state

Fixes issue with hang where yield was told to stop producing and but then was told it could continue producing before the next call to yield.
@adam-fowler adam-fowler requested a review from Joannis as a code owner January 27, 2025 10:31
@adam-fowler adam-fowler mentioned this pull request Jan 27, 2025
Copy link
Member

@Joannis Joannis left a comment

Choose a reason for hiding this comment

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

LGTM, one performance remark here.

Sources/HummingbirdCore/Request/RequestBody.swift Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jan 29, 2025

Codecov Report

Attention: Patch coverage is 87.34177% with 10 lines in your changes missing coverage. Please review.

Project coverage is 83.77%. Comparing base (b1bc64f) to head (cff29c0).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
Sources/HummingbirdCore/Request/RequestBody.swift 87.34% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #666      +/-   ##
==========================================
+ Coverage   83.69%   83.77%   +0.07%     
==========================================
  Files         116      116              
  Lines        7276     7339      +63     
==========================================
+ Hits         6090     6148      +58     
- Misses       1186     1191       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@adam-fowler adam-fowler enabled auto-merge (squash) January 29, 2025 15:00
@adam-fowler adam-fowler merged commit c1d1757 into main Jan 29, 2025
9 of 10 checks passed
bcbod2002 pushed a commit to bcbod2002/hummingbird that referenced this pull request Feb 6, 2025
…roject#666)

* Combine RequestBody delegate produceMore and waiting continuations into single state

Fixes issue with hang where yield was told to stop producing and but then was told it could continue producing before the next call to yield.

* Attempt to remove withCheckedContinuation for produceMore state

* Avoid allocating deque if only one continuation is created

* Update codecov token

* Resume all continuations on produceMore
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.

2 participants