Implement graceful shutdown for listeners, admin socket, eviction task, and ACME

- Replace handle.abort() for HTTPS server tasks with timeout-based join,
  allowing in-flight requests to drain before forceful shutdown
- Add shutdown_rx to start_admin_socket with tokio::select! for clean
  accept loop exit and Unix socket file cleanup on shutdown
- Add shutdown_rx to start_eviction_task with tokio::select! for
  cancellable eviction loop
- Add shutdown channel to spawn_acme_state for cancellable ACME state
  machine via tokio::select!
- Pass Arc<GracefulShutdown> through setup_tls to ACME state machine
- Move GracefulShutdown creation before admin socket and TLS setup
- Update integration test for new start_eviction_task signature
This commit is contained in:
2026-06-12 04:59:18 +00:00
parent abc8a44134
commit 280fe782a1
6 changed files with 177 additions and 113 deletions

View File

@@ -244,10 +244,12 @@ async fn test_rate_limit_eviction_task() {
limiter.check_and_consume(std::net::IpAddr::from([192, 168, 1, 1]));
let shutdown = Arc::new(reverse_proxy::shutdown::GracefulShutdown::new(30));
let handle = reverse_proxy::rate_limit::start_eviction_task(
limiter.clone(),
Duration::from_millis(50),
Duration::from_millis(100),
shutdown.subscribe(),
);
tokio::time::sleep(Duration::from_millis(200)).await;