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

Implement async pagination #10021

Merged
merged 8 commits into from
Nov 21, 2024
Merged

Implement async pagination #10021

merged 8 commits into from
Nov 21, 2024

Conversation

Turbo87
Copy link
Member

@Turbo87 Turbo87 commented Nov 20, 2024

aka. fighting with the borrow checker and internal compiler errors... 🙈

but hey, it compiles now and seems to work, so I guess that's good? 😆

@Turbo87 Turbo87 added C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear A-backend ⚙️ labels Nov 20, 2024
Copy link
Contributor

@eth3lbert eth3lbert left a comment

Choose a reason for hiding this comment

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

I've left some comments that aren't blockers.

Aside from the lifetime part, which I'm unsure about it, this PR looks great to me! And since it compiles and passes the test cases, I'm leaning towards accepting it. Awesome job! 👍

src/controllers/helpers/pagination.rs Show resolved Hide resolved
src/controllers/helpers/pagination.rs Show resolved Hide resolved
Comment on lines +255 to 263
pub fn load<'a, U>(
self,
conn: &'a mut AsyncPgConnection,
) -> BoxFuture<'a, QueryResult<Paginated<U>>>
where
Self: LoadQuery<'a, Conn, WithCount<U>>,
Self: diesel_async::methods::LoadQuery<'a, AsyncPgConnection, WithCount<U>>,
T: 'a,
U: Send + 'a,
{
Copy link
Contributor

Choose a reason for hiding this comment

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

I admit that I'm unsure about whether the lifetime 'a here remains exactly the same as 'conn and 'query in diesel-async.

Copy link
Member Author

Choose a reason for hiding this comment

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

no clue. I followed the suggestions of the compiler (when it wasn't crashing) and somehow made it work that way 😅

@Turbo87 Turbo87 merged commit 2b78c36 into rust-lang:main Nov 21, 2024
8 checks passed
@Turbo87 Turbo87 deleted the async-pagination branch November 21, 2024 09:11
Copy link

codecov bot commented Nov 21, 2024

Codecov Report

Attention: Patch coverage is 99.59677% with 1 line in your changes missing coverage. Please review.

Project coverage is 89.19%. Comparing base (af856c6) to head (fb99e47).
Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
src/controllers/krate/search.rs 99.42% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10021      +/-   ##
==========================================
- Coverage   89.22%   89.19%   -0.04%     
==========================================
  Files         295      295              
  Lines       30784    30785       +1     
==========================================
- Hits        27468    27459       -9     
- Misses       3316     3326      +10     

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


🚨 Try these New Features:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backend ⚙️ C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants