async-await (wip) #3
Merged
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.
I'm trying to use https://github.com/socketry/async-await instead of https://github.com/Shopify/graphql-batch following the example from https://github.com/socketry/async-await/blob/00052e12a80ff02b3821222c52a8aed5f1c99799/examples/sleep_sort.rb but running into some trouble.
When running the server, the Rack app returns
[2,2,3,4,5]
which doesn't include all of the numbers I would expect. The logs look like this:So, you can see we're returning the result and finishing the request before we're done with the sorting.
I'm sure I'm misunderstanding how this is all supposed to work, but I'm not clear about a few things:
sort
returns a promise (Async::Task
) but do we need to callbarrier!
in there and alsoresult
sync def call(env)
method, or do we need to do something elseclass << self
syntax instead ofsync def self.call(env)
which might be a gotcha