Migrate deprecated Async::Variable to Async::Promise#226
Merged
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a91f024239
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Contributor
Author
|
OK, I thought it was just a rename, I'll do a proper fix this weekend. |
`Async::Variable` is deprecated in favour of `Async::Promise`. Renaming the
class alone is not enough: `Async::Promise` has no `value=` writer, so the
completion signal `@closed.value = true` must become `@closed.resolve(true)`,
otherwise closing a read HTTP/1 body raises `NoMethodError`.
- finishable.rb: use `Async::Promise` and `resolve(true)` to signal completion.
- Raise the async dependency to `>= 2.35.1`. `Async::Promise` was introduced in
2.29.0, and 2.35.1 fixes a spurious-wakeup bug in `Async::Promise#wait` — the
exact indefinite wait path `Finishable#wait` relies on.
- Migrate the remaining `Async::Variable` usages in the test fixtures.
- Clean up adjacent deprecations in the fixture along the way
(`Async::Reactor.run{}` -> `Async{}`, `Async::Task#sleep` -> `Kernel#sleep`).
Async::Variable to Async::Promise
Contributor
Author
|
@samuel-williams-shopify Note: Claude helps me make the patch |
Member
|
Thanks for this, nice work. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Async::Variableis deprecated in favour ofAsync::Promise, producing:Simply renaming the class is not enough.
Async::Promisedoes not provide thevalue=writer thatAsync::Variablealiased toresolve, so the completion signal@closed.value = trueinFinishable#closehas to become@closed.resolve(true)— otherwise closing an HTTP/1 body that has been read raisesNoMethodError, breaking normal request handling. Thanks to the Codex review for catching this.Changes
http1/finishable.rb: useAsync::Promiseandresolve(true)to signal completion.asyncto>= 2.35.1.Async::Promisewas introduced in async 2.29.0, so the previous floor (>= 2.10.2) could not load it.Async::Promise#wait— the exact indefinite wait pathFinishable#waitrelies on to block until the body is fully consumed before a persistent connection is reused. (Happy to relax this to>= 2.29.0if you'd prefer a lower floor.)Async::Variableusages (a_protocol.rband two HTTP/2 tests).a_protocol.rb, replace two other deprecated calls —Async::Reactor.run{}→Async{}andAsync::Task#sleep→Kernel#sleep.I left the version bump and
releases.mdentry for you to handle as part of your release flow.Verification
sussuite passes (227 passed / 3 skipped), unchanged frommain.ruby -w, no deprecation warnings originate from async-http's own code (the only remaining one comes from the externalsus-fixtures-asyncgem).