don't add state to router in init()
This commit is contained in:
@@ -53,9 +53,9 @@ where
|
|||||||
// self
|
// self
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/// Build and initialize the server. Returns the base router and a future to run
|
/// Build and initialize the server. Returns the base router, finalized state, and a future to run
|
||||||
/// on graceful shutdown.
|
/// on graceful shutdown.
|
||||||
pub async fn init(mut self) -> anyhow::Result<(Router, impl Future + Send)>
|
pub async fn init(mut self) -> anyhow::Result<(Router<S>, S, impl Future + Send)>
|
||||||
where
|
where
|
||||||
S::Error: Display,
|
S::Error: Display,
|
||||||
{
|
{
|
||||||
@@ -77,7 +77,7 @@ where
|
|||||||
.filter_map(|mut p| p.on_shutdown(&state));
|
.filter_map(|mut p| p.on_shutdown(&state));
|
||||||
let on_shutdown = join_all(shutdown_fns);
|
let on_shutdown = join_all(shutdown_fns);
|
||||||
|
|
||||||
Ok((router.with_state(state), on_shutdown))
|
Ok((router, state, on_shutdown))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user