abstract shutdown/reload functionality.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
30e7298dd7
commit
08f2b8579c
6 changed files with 49 additions and 26 deletions
|
@ -13,7 +13,7 @@ use tracing::{debug, error, trace};
|
|||
pub(crate) async fn spawn(
|
||||
State(server): State<Arc<Server>>, req: http::Request<axum::body::Body>, next: axum::middleware::Next,
|
||||
) -> Result<axum::response::Response, StatusCode> {
|
||||
if server.stopping.load(Ordering::Relaxed) {
|
||||
if !server.running() {
|
||||
debug_warn!("unavailable pending shutdown");
|
||||
return Err(StatusCode::SERVICE_UNAVAILABLE);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ pub(crate) async fn spawn(
|
|||
pub(crate) async fn handle(
|
||||
State(server): State<Arc<Server>>, req: http::Request<axum::body::Body>, next: axum::middleware::Next,
|
||||
) -> Result<axum::response::Response, StatusCode> {
|
||||
if server.stopping.load(Ordering::Relaxed) {
|
||||
if !server.running() {
|
||||
debug_warn!(
|
||||
method = %req.method(),
|
||||
uri = %req.uri(),
|
||||
|
|
|
@ -25,7 +25,6 @@ pub(crate) async fn run(server: Arc<Server>) -> Result<(), Error> {
|
|||
_ = services().admin.handle.lock().await.insert(admin::handle);
|
||||
|
||||
// Setup shutdown/signal handling
|
||||
server.stopping.store(false, Ordering::Release);
|
||||
let handle = ServerHandle::new();
|
||||
let (tx, _) = broadcast::channel::<()>(1);
|
||||
let sigs = server
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue