-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4376 from systeminit/nick/eng-2640
Remove unused oneshot channel from USR2 sdf work
- Loading branch information
Showing
3 changed files
with
59 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
use super::{ | ||
server::ServerError, | ||
state::{AppState, ApplicationRuntimeMode}, | ||
}; | ||
use axum::{ | ||
extract::State, | ||
http::{HeaderValue, Request, StatusCode}, | ||
|
@@ -20,6 +16,13 @@ use thiserror::Error; | |
use tower_http::cors::CorsLayer; | ||
use tower_http::{compression::CompressionLayer, cors::AllowOrigin}; | ||
|
||
use super::{ | ||
server::ServerError, | ||
state::{AppState, ApplicationRuntimeMode}, | ||
}; | ||
|
||
const MAINTENANCE_MODE_MESSAGE: &str = " SI is currently in maintenance mode. Please try again later. Reach out to [email protected] or in the SI Discord for more information if this problem persists"; | ||
|
||
async fn app_state_middeware<B>( | ||
State(state): State<AppState>, | ||
request: Request<B>, | ||
|
@@ -28,7 +31,7 @@ async fn app_state_middeware<B>( | |
match *state.application_runtime_mode.read().await { | ||
ApplicationRuntimeMode::Maintenance => { | ||
// Return a 503 when the server is in maintenance/offline | ||
(StatusCode::SERVICE_UNAVAILABLE, " SI is currently in maintenance mode. Please try again later. Reach out to [email protected] or in the SI Discord for more information if this problem persists").into_response() | ||
(StatusCode::SERVICE_UNAVAILABLE, MAINTENANCE_MODE_MESSAGE).into_response() | ||
} | ||
ApplicationRuntimeMode::Running => next.run(request).await, | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters