MCPcopy Create free account
hub / github.com/actix/examples / timeout_10secs

Function timeout_10secs

middleware/various/src/main.rs:17–25  ·  view source on GitHub ↗
(
    req: dev::ServiceRequest,
    next: Next<impl MessageBody + 'static>,
)

Source from the content-addressed store, hash-verified

15mod simple;
16
17async fn timeout_10secs(
18 req: dev::ServiceRequest,
19 next: Next<impl MessageBody + 'static>,
20) -> Result<dev::ServiceResponse<impl MessageBody>, Error> {
21 match time::timeout(Duration::from_secs(10), next.call(req)).await {
22 Ok(res) => res,
23 Err(_err) => Err(actix_web::error::ErrorRequestTimeout("")),
24 }
25}
26
27#[actix_web::main]
28async fn main() -> std::io::Result<()> {

Callers

nothing calls this directly

Calls 1

callMethod · 0.45

Tested by

no test coverage detected