deps.rs icon indicating copy to clipboard operation
deps.rs copied to clipboard

refactor: migrate web server to Actix Web

Open robjtede opened this issue 1 year ago • 5 comments

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 avatar May 27 '24 05:05 robjtede

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.

Enet4 avatar May 31 '24 10:05 Enet4

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 https://github.com/hyperium/h2/issues/531? Or does actix-web have a solution for it?

paolobarbolini avatar Aug 31 '24 08:08 paolobarbolini

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.

robjtede avatar Aug 31 '24 17:08 robjtede

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

Enet4 avatar Sep 19 '24 14:09 Enet4

ahh yes

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

robjtede avatar Sep 20 '24 08:09 robjtede