Skip to content

Commit

Permalink
feat: Make keep alive timeout configurable (still default to 5 second…
Browse files Browse the repository at this point in the history
…s) (#650)
  • Loading branch information
chriswk authored Jan 10, 2025
1 parent cb95f1a commit d786816
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,10 @@ pub struct CliArgs {
#[clap(long, env, default_value_t = 5)]
pub edge_request_timeout: u64,

/// Keepalive timeout for requests to Edge
#[clap(long, env, default_value_t = 5)]
pub edge_keepalive_timeout: u64,

/// Which log format should Edge use
#[clap(short, long, env, global = true, value_enum, default_value_t = LogFormat::Plain)]
pub log_format: LogFormat,
Expand Down
2 changes: 2 additions & 0 deletions server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ async fn main() -> Result<(), anyhow::Error> {
let http_args = args.clone().http;
let token_header = args.clone().token_header;
let request_timeout = args.edge_request_timeout;
let keepalive_timeout = args.edge_keepalive_timeout;
let trust_proxy = args.clone().trust_proxy;
let base_path = http_args.base_path.clone();
let (metrics_handler, request_metrics) = prom_metrics::instantiate(None, &args.log_format);
Expand Down Expand Up @@ -161,6 +162,7 @@ async fn main() -> Result<(), anyhow::Error> {
let server = server?
.workers(http_args.workers)
.shutdown_timeout(5)
.keep_alive(std::time::Duration::from_secs(keepalive_timeout))
.client_request_timeout(std::time::Duration::from_secs(request_timeout));

match schedule_args.mode {
Expand Down

0 comments on commit d786816

Please sign in to comment.