Return instead of yield from Concurrent::Promise (Ruby 3.1 compat)#720
Merged
byroot merged 1 commit intorails:masterfrom Oct 13, 2021
Merged
Return instead of yield from Concurrent::Promise (Ruby 3.1 compat)#720byroot merged 1 commit intorails:masterfrom
byroot merged 1 commit intorails:masterfrom
Conversation
af158b8 to
68b7b8d
Compare
68b7b8d to
6fcc0d1
Compare
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.
So i have to admit I don't fully understand what's going nor how it even worked until now.
While testing ruby 3.1.0-dev on a Rails app using sprockets 4.0.2, I get the following error:
I dug into
concurrent-rubyand somehow thewait!on the promise is supposed to return multiple values, but simply return nil.I think it's caused by the fact that we
yieldwhen we're supposed to return, so we're somehow interupting the flow.But looking at the original code I don't even get how it's supposed to work in the first place:
The block passed to
Concurrent::Promise.executeexecutes in a background thread, so there's no-one toyieldto.What's weird is that the thread is like immediately killed, there's no backtraces or anything, so that might be a Ruby bug of some sort.
Either way, we should return rather than yield.