-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
graphql: migrate graphql to use async connections #19234
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Skipped Deployments
|
f8eb2ca
to
0d0609a
Compare
0d0609a
to
80c4f18
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a question about what scope_boxed
is doing for us, in case we can't elide it, but otherwise, LGTM!
.execute(move |conn| { | ||
conn.results(move || { | ||
dsl::packages.filter(dsl::package_id.eq_any(ids.iter().cloned())) | ||
}) | ||
async move { | ||
conn.results(move || { | ||
dsl::packages.filter(dsl::package_id.eq_any(ids.iter().cloned())) | ||
}) | ||
.await | ||
} | ||
.scope_boxed() | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to have the transactional API execute
, execute_repeatable
etc accept a callback that it can call scope_boxed
on? so that this could become:
.execute(|conn| async move {
conn.results(move || {
dsl::packages.filter(dsl::package_id.eq_any(ids.iter().cloned()))
})
.await
})
If we can't elide it like that, I'm generally curious to learn more about scope_boxed
and when we should and shouldn't use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried for a while to not require this as a part of the trait api but kept hitting lifetime issues bounding the lifetime of the produced future from the provided closure in order to meet the needs of the transaction api diesel-async
required. Once i finish this migration i'll take another pass back at this to see if it can be simplified and not require the explicit bounding with scope_boxed
Description
Describe the changes or additions included in this PR.
Test plan
How did you test the new or updated feature?
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.