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

refactor: migrate web server to Actix Web #229

Merged
merged 1 commit into from
Nov 2, 2024
Merged

Conversation

robjtede
Copy link
Member

@robjtede robjtede commented May 27, 2024

full-fat Actix Web conversion including (somewhat necessary) improvements to error handling

pros:

  • –91 LoC (smallest final result)
  • clearer error handling
  • we can use automatic HTTP/2 connections from the reverse proxy if we want to
  • access to large library of first- and third-party middleware

cons:

  • biggest diff

tokei:

 Language            Files        Lines         Code     Comments       Blanks
===============================================================================
 Rust                   31         3861         3324           21          516
 |- Markdown             5           47            0           42            5
 (Total)                           3908         3324           63          521

@robjtede robjtede changed the title refactor: migrate to tracing for logging refactor: migrate web server to Actix Web May 27, 2024
@robjtede robjtede changed the title refactor: migrate web server to Actix Web refactor: migrate web server to Actix Web May 27, 2024
@robjtede robjtede linked an issue May 27, 2024 that may be closed by this pull request
@robjtede robjtede mentioned this pull request May 27, 2024
Base automatically changed from tracing to main May 29, 2024 10:35
@Enet4
Copy link
Contributor

Enet4 commented May 31, 2024

The pull requests are in need of a rebase after the migration to tracing, but other than that I hold no objections to moving forward with Actix Web once that is resolved.

@robjtede robjtede marked this pull request as ready for review June 1, 2024 13:21
@robjtede robjtede added the maintenance Keeping the wheels turning label Jun 1, 2024
@paolobarbolini
Copy link
Member

I haven't used actix-web in a while and just seeing the much better out of the box error handling is refreshing.

we can use automatic HTTP/2 connections from the reverse proxy if we want to

Is that worth it given hyperium/h2#531? Or does actix-web have a solution for it?

@robjtede
Copy link
Member Author

Actix Web is already thread-per-core so each worker would have its own "instance" of h2, meaning the mutexes are uncontended. IIRC things are fast in such cases.

@Enet4
Copy link
Contributor

Enet4 commented Sep 19, 2024

This is in need of a rebase again. Can you handle this?

@robjtede robjtede force-pushed the actix-web branch 2 times, most recently from 4fbb06c to 7c50788 Compare September 19, 2024 19:56
Copy link
Contributor

@Enet4 Enet4 left a comment

Choose a reason for hiding this comment

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

The crate_redirect endpoint (GET /crate/:name) stopped working with the new code. I could not understand why from looking at the code, but maybe you have a better clue.

Screenshot 2024-09-20 094004

@robjtede
Copy link
Member Author

ahh yes

- #[get("/crate/:name")]
+ #[get("/crate/{name}")]

Copy link
Contributor

@Enet4 Enet4 left a comment

Choose a reason for hiding this comment

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

That worked! I found no other issues in this migration. 👍

@paolobarbolini paolobarbolini merged commit e0eb547 into main Nov 2, 2024
4 checks passed
@paolobarbolini paolobarbolini deleted the actix-web branch November 2, 2024 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Keeping the wheels turning
Projects
None yet
Development

Successfully merging this pull request may close these issues.

web server upgrade
4 participants