Add option for worker status max body size
This commit is contained in:
parent
f2338a17eb
commit
8496c557f6
2 changed files with 16 additions and 2 deletions
|
|
@ -34,6 +34,10 @@ mod default {
|
|||
Duration::from_secs(60)
|
||||
}
|
||||
|
||||
pub fn web_worker_max_upload() -> usize {
|
||||
1024 * 1024 * 8 // 8 MiB
|
||||
}
|
||||
|
||||
pub fn repo_update_delay() -> Duration {
|
||||
Duration::from_secs(60)
|
||||
}
|
||||
|
|
@ -59,6 +63,9 @@ struct Web {
|
|||
|
||||
#[serde(default = "default::web_worker_timeout")]
|
||||
worker_timeout: Duration,
|
||||
|
||||
#[serde(default = "default::web_worker_max_upload")]
|
||||
worker_max_upload: usize,
|
||||
}
|
||||
|
||||
impl Default for Web {
|
||||
|
|
@ -68,6 +75,7 @@ impl Default for Web {
|
|||
address: default::web_address(),
|
||||
worker_token: None,
|
||||
worker_timeout: default::web_worker_timeout(),
|
||||
worker_max_upload: default::web_worker_max_upload(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -226,6 +234,7 @@ pub struct Config {
|
|||
pub web_address: SocketAddr,
|
||||
pub web_worker_token: String,
|
||||
pub web_worker_timeout: Duration,
|
||||
pub web_worker_max_upload: usize,
|
||||
pub repo_name: String,
|
||||
pub repo_update_delay: Duration,
|
||||
pub worker_name: String,
|
||||
|
|
@ -263,6 +272,7 @@ impl Config {
|
|||
web_address: config_file.web.address,
|
||||
web_worker_token,
|
||||
web_worker_timeout: config_file.web.worker_timeout,
|
||||
web_worker_max_upload: config_file.web.worker_max_upload,
|
||||
repo_name,
|
||||
repo_update_delay: config_file.repo.update_delay,
|
||||
worker_name,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ mod pages;
|
|||
pub mod paths;
|
||||
mod r#static;
|
||||
|
||||
use axum::{routing::get, Router};
|
||||
use axum::{extract::DefaultBodyLimit, routing::get, Router};
|
||||
use axum_extra::routing::RouterExt;
|
||||
|
||||
use crate::somehow;
|
||||
|
|
@ -34,6 +34,10 @@ use super::Server;
|
|||
pub async fn run(server: Server) -> somehow::Result<()> {
|
||||
// TODO Add text body to body-less status codes
|
||||
|
||||
let post_api_worker_status = Router::new()
|
||||
.typed_post(post_api_worker_status)
|
||||
.layer(DefaultBodyLimit::max(server.config.web_worker_max_upload));
|
||||
|
||||
let app = Router::new()
|
||||
.typed_get(get_api_worker_bench_repo_by_hash_tree_tar_gz)
|
||||
.typed_get(get_api_worker_repo_by_hash_tree_tar_gz)
|
||||
|
|
@ -48,7 +52,7 @@ pub async fn run(server: Server) -> somehow::Result<()> {
|
|||
.typed_post(post_admin_queue_decrease)
|
||||
.typed_post(post_admin_queue_delete)
|
||||
.typed_post(post_admin_queue_increase)
|
||||
.typed_post(post_api_worker_status)
|
||||
.merge(post_api_worker_status)
|
||||
.fallback(get(r#static::static_handler))
|
||||
.with_state(server.clone());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue