This commit is contained in:
Ruben Fiszel
2026-01-09 12:50:08 +00:00
parent da8f8e11b2
commit 79780ff8ac
2 changed files with 14 additions and 0 deletions
+1
View File
@@ -342,6 +342,7 @@ fn print_help() {
println!(" SERVER_BIND_ADDR = {} IP to bind the server to", DEFAULT_SERVER_BIND_ADDR);
println!(" NUM_WORKERS = {} Number of workers (standalone/worker modes)", DEFAULT_NUM_WORKERS);
println!(" WORKER_GROUP = default Worker group this worker belongs to",);
println!(" QUIT_AFTER_FIRST_PING = false Exit worker after first successful ping (useful for testing)");
println!(" JSON_FMT = false Output logs in JSON instead of logfmt");
println!(" METRICS_ADDR = None (EE only) Prometheus metrics addr at /metrics; set \"true\" to use :8001");
println!(" SUPERADMIN_SECRET = None Virtual superadmin token (server)");
+13
View File
@@ -316,6 +316,11 @@ lazy_static::lazy_static! {
.and_then(|x| x.parse::<bool>().ok())
.unwrap_or(false);
pub static ref QUIT_AFTER_FIRST_PING: bool = std::env::var("QUIT_AFTER_FIRST_PING")
.ok()
.and_then(|x| x.parse::<bool>().ok())
.unwrap_or(false);
pub static ref UNSHARE_TINI_PATH: String = {
std::env::var("UNSHARE_TINI_PATH").unwrap_or_else(|_| "tini".to_string())
};
@@ -1265,6 +1270,14 @@ pub async fn run_worker(
.await
.expect("initial ping could be sent");
if *QUIT_AFTER_FIRST_PING {
tracing::info!(
worker = %worker_name, hostname = %hostname,
"QUIT_AFTER_FIRST_PING is set, exiting after successful initial ping"
);
return;
}
#[cfg(feature = "prometheus")]
let uptime_metric = if METRICS_ENABLED.load(Ordering::Relaxed) {
Some(