Crate Actix Web
Website: https://actix.rs/
List of useful doc items π
Log (record) unmatched routes π
Add a default service and route (This example uses tracing to do the recording)
default_service(web::route().to(not_found)); // Added into config
#[tracing::instrument]
pub async fn not_found(req: HttpRequest) -> actix_web::Result<HttpResponse> {
error!("Failed to match route");
Ok(HttpResponse::NotFound().body("404 - Not found\n"))
}
Graceful shutdown π
There are multiple references I found and the appropriate one depends on your use case. Iβm collecting them here because I donβt want to have to search for them again. I recommend also checking out Tokio Cancellation Tokens as well as applicable to your use case.
Resources:
- Official example of shutdown - It shows how to shutdown from an endpoint
- Example Response to issue - Shows how to shutdown if there is another task running in parallel to actix_web. Both tasks get shutdown gracefully. To shutdown the second task Iβd recommend using Tokio Cancellation Tokens instead.
- Official Documentation website - Explains the default behaviour