Skip to content

Commit

Permalink
Revert "feat(make shutdown duration configurable): move graceful_shut…
Browse files Browse the repository at this point in the history
…down_duration to top-level config"

This reverts commit c20100c.
  • Loading branch information
DominicBurkart committed May 24, 2023
1 parent c20100c commit 76f4332
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 12 deletions.
7 changes: 7 additions & 0 deletions lib/vector-core/src/config/global_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ pub struct GlobalOptions {
skip_serializing_if = "crate::serde::skip_serializing_if_default"
)]
pub expire_metrics_secs: Option<f64>,

/// The amount of time, in seconds, that Vector waits for internal processes to stop gracefully
/// after a SIGINT or SIGTERM is received. Default is 60 seconds. Set to -1 to never force
/// shutdown after SIGINT/SIGTERM received.
#[serde(default)]
pub graceful_shutdown_duration: i64,
}

impl GlobalOptions {
Expand Down Expand Up @@ -228,6 +234,7 @@ impl GlobalOptions {
proxy: self.proxy.merge(&with.proxy),
expire_metrics: self.expire_metrics.or(with.expire_metrics),
expire_metrics_secs: self.expire_metrics_secs.or(with.expire_metrics_secs),
graceful_shutdown_duration: self.graceful_shutdown_duration,
})
} else {
Err(errors)
Expand Down
2 changes: 1 addition & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ pub async fn load_configs(
info!("Health checks are disabled.");
}
config.healthchecks.set_require_healthy(require_healthy);
config.graceful_shutdown_duration = graceful_shutdown_duration;
config.global.graceful_shutdown_duration = graceful_shutdown_duration;

Ok(config)
}
Expand Down
7 changes: 0 additions & 7 deletions src/config/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ pub struct ConfigBuilder {
/// All configured secrets backends.
#[serde(default)]
pub secret: IndexMap<ComponentKey, SecretBackends>,

/// Set the duration in seconds to wait for graceful shutdown after SIGINT or SIGTERM are received.
/// After the duration has passed, Vector will force shutdown. Default value is 60 seconds. If set
/// to -1, Vector will never force shutdown.
pub graceful_shutdown_duration: i64,
}

#[cfg(feature = "enterprise")]
Expand Down Expand Up @@ -200,7 +195,6 @@ impl From<Config> for ConfigBuilder {
transforms,
tests,
secret,
graceful_shutdown_duration,
hash: _,
} = config;

Expand Down Expand Up @@ -231,7 +225,6 @@ impl From<Config> for ConfigBuilder {
provider: None,
tests,
secret,
graceful_shutdown_duration,
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/config/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ pub fn compile(mut builder: ConfigBuilder) -> Result<(Config, Vec<String>), Vec<
tests,
provider: _,
secret,
graceful_shutdown_duration,
} = builder;

let graph = match Graph::new(&sources, &transforms, &sinks, schema) {
Expand Down Expand Up @@ -112,7 +111,6 @@ pub fn compile(mut builder: ConfigBuilder) -> Result<(Config, Vec<String>), Vec<
transforms,
tests,
secret,
graceful_shutdown_duration,
};

config.propagate_acknowledgements()?;
Expand Down
1 change: 0 additions & 1 deletion src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ pub struct Config {
pub enrichment_tables: IndexMap<ComponentKey, EnrichmentTableOuter>,
tests: Vec<TestDefinition>,
secret: IndexMap<ComponentKey, SecretBackends>,
pub graceful_shutdown_duration: i64,
}

impl Config {
Expand Down
2 changes: 1 addition & 1 deletion src/topology/running.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl RunningTopology {
abort_tx,
watch: watch::channel(TapResource::default()),
running: Arc::new(AtomicBool::new(true)),
graceful_shutdown_duration: match config.graceful_shutdown_duration {
graceful_shutdown_duration: match config.global.graceful_shutdown_duration {
-1 => None,
seconds => Some(Duration::from_secs(seconds as u64)), // clap validator makes sure value is >= -1
},
Expand Down

0 comments on commit 76f4332

Please sign in to comment.