Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions crates/walgit-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,8 @@ pub struct Config {
pub struct ServerConfig {
pub listen: SocketAddr,
pub http2: bool,
pub max_concurrent_requests: usize,
/// Per-repo cap on concurrent upload-pack/receive-pack processes.
pub max_concurrent_per_repo: usize,
#[serde(with = "humantime_serde")]
pub request_timeout: Duration,
/// Graceful drain after SIGTERM: new object work (fetch/push/LFS) is
/// refused with 503 + Retry-After and `/readyz` turns 503 at once; in-flight
/// requests and the running maintenance unit get this long to finish
Expand Down Expand Up @@ -797,9 +794,7 @@ impl Default for ServerConfig {
ServerConfig {
listen: std::net::SocketAddr::from(([127, 0, 0, 1], 8080)),
http2: true,
max_concurrent_requests: 512,
max_concurrent_per_repo: 64,
request_timeout: Duration::from_hours(1),
drain_timeout: Duration::from_secs(20),
max_push_bytes: ByteSize::gib(64),
roles: vec![],
Expand Down Expand Up @@ -1529,6 +1524,17 @@ mod tests {
assert!(!base.public_settings_toml().unwrap().contains("[bundles]"));
}

#[test]
fn removed_global_request_limit_configuration_is_rejected() {
for input in [
"[server]\nmax_concurrent_requests = 512\n",
"[server]\nrequest_timeout = \"1h\"\n",
] {
assert!(Config::parse(input).is_err(), "{input}");
assert!(Config::default().with_settings(input).is_err(), "{input}");
}
}

#[test]
fn removed_compaction_configuration_is_rejected() {
for input in [
Expand Down
6 changes: 2 additions & 4 deletions crates/walgit-server/src/middleware.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! HTTP middleware: request id + tracing span. Request timeout, body limit and
//! tracing layers are applied in [`crate::router`] via `tower-http`. Per-repo
//! concurrency limiting lives in the handlers (they hold a repo-keyed semaphore
//! for the duration of the git operation).
//! HTTP middleware: request id + tracing span and per-repository concurrency
//! limits. Per-repository permits live in handlers for the full Git operation.

use std::sync::Arc;
use std::sync::atomic::{AtomicU64, Ordering};
Expand Down
1 change: 0 additions & 1 deletion crates/walgit-server/tests/harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ impl Server {
cfg.cache.max_bytes = ByteSize::gib(2);
cfg.server.listen = "127.0.0.1:0".parse().unwrap();
cfg.server.max_concurrent_per_repo = 8;
cfg.server.request_timeout = std::time::Duration::from_mins(10);
cfg.server.max_push_bytes = ByteSize::gib(2);
cfg.wal.fsck_objects = true;
cfg.wal.check_connectivity = true;
Expand Down
2 changes: 0 additions & 2 deletions walgit.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
[server]
listen = "127.0.0.1:8080" # default; `mode = none` is refused unless this is loopback. Public bind: 0.0.0.0 with token/oidc.
http2 = true # HTTP/2 (h2c when TLS is off, ALPN when on)
max_concurrent_requests = 512 # global cap on in-flight git requests
max_concurrent_per_repo = 64 # per-repo cap (upload-pack / receive-pack)
request_timeout = "1h"
drain_timeout = "20s" # after SIGTERM, phase 2: how long in-flight requests may finish once /readyz is 503
# and new fetch/push/LFS are refused (503 + Retry-After). The running maintenance unit
# is interrupted at once in phase 1 while serving continues.
Expand Down