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

editoast: replace actix_web::web::Data by Arc in models #7418

Merged
merged 1 commit into from
May 15, 2024

Conversation

hamz2a
Copy link
Contributor

@hamz2a hamz2a commented May 15, 2024

Part of #6980

@hamz2a hamz2a requested a review from a team as a code owner May 15, 2024 12:59
@codecov-commenter
Copy link

codecov-commenter commented May 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.84%. Comparing base (5b12cb9) to head (c354aed).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@              Coverage Diff              @@
##                dev    #7418       +/-   ##
=============================================
+ Coverage     29.15%   54.84%   +25.69%     
=============================================
  Files          1164       67     -1097     
  Lines        144102     3878   -140224     
  Branches       2811        0     -2811     
=============================================
- Hits          42013     2127    -39886     
+ Misses       100428     1751    -98677     
+ Partials       1661        0     -1661     
Flag Coverage Δ
core ?
editoast ?
front ?
gateway 2.41% <ø> (ø)
railjson_generator 87.49% <ø> (ø)
tests 83.96% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@hamz2a hamz2a force-pushed the hai/editoast-remove-actix-web-data-from-models branch from 5b10688 to c363926 Compare May 15, 2024 13:51
@hamz2a hamz2a changed the title editoast: remove actix_web::web::Data from models editoast: replace actix_web::web::Data by Arc in models May 15, 2024
Copy link
Contributor

@leovalais leovalais left a comment

Choose a reason for hiding this comment

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

Thanks for this cleanup that's long overdue! :D

I'd replace the occurrences of db_pool.clone().into_inner() by db_pool.into_inner() directly when possible. When it's not, I'd prefer to extract the Arc first and then clone the arc directly.
That doesn't block this PR, but I'd rather get rid of the Data as early as possible.

foo(db_pool.clone().into_inner());
bar(db_pool.into_inner());

// would become

let db_pool = db_pool.into_inner();
foo(db_pool.clone());
bar(db_pool);

(You can use sed -y to swap clone() and into_inner() to quickly spot the places that need that change.)

This will likely conflict with #7281

editoast/editoast_derive/src/model.rs Outdated Show resolved Hide resolved
editoast/src/main.rs Outdated Show resolved Hide resolved
editoast/src/views/infra/mod.rs Outdated Show resolved Hide resolved
editoast/src/views/infra/mod.rs Outdated Show resolved Hide resolved
editoast/src/views/infra/mod.rs Outdated Show resolved Hide resolved
@hamz2a hamz2a force-pushed the hai/editoast-remove-actix-web-data-from-models branch from c363926 to e89eac8 Compare May 15, 2024 15:14
@hamz2a hamz2a requested a review from leovalais May 15, 2024 15:16
Copy link
Contributor

@leovalais leovalais left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! :)

editoast/src/views/infra/railjson.rs Outdated Show resolved Hide resolved
@hamz2a hamz2a force-pushed the hai/editoast-remove-actix-web-data-from-models branch from e89eac8 to c354aed Compare May 15, 2024 15:39
@hamz2a hamz2a enabled auto-merge May 15, 2024 15:39
@hamz2a hamz2a added this pull request to the merge queue May 15, 2024
Merged via the queue into dev with commit b1fe188 May 15, 2024
17 checks passed
@hamz2a hamz2a deleted the hai/editoast-remove-actix-web-data-from-models branch May 15, 2024 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants