Skip to content

Commit 698a3c6

Browse files
committed
Revert "add support to customizable startup delay for processes"
This reverts commit 59a3ea2.
1 parent 59a3ea2 commit 698a3c6

File tree

3 files changed

+3
-18
lines changed

3 files changed

+3
-18
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ clap = { version = "4.4.10", features = ["derive"] }
4343
colored = "2.1.0"
4444
ctrlc = "3.4.5"
4545
dotenvy = "0.15.7"
46-
duration-str = "0.13.0"
4746
futures-util = "0.3.30"
4847
http = "1.1.0"
4948
itertools = "0.13.0"

src/config.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ use serde::{Deserialize, Serialize};
44
use std::{
55
collections::HashSet,
66
fs::{self, File},
7-
io::{Read, Write}, time::Duration,
7+
io::{Read, Write},
88
};
9-
use duration_str::deserialize_option_duration;
109

1110
#[cfg(not(windows))]
1211
static EXAMPLE_CONFIG: &str = include_str!("templates/cardamon.unix.toml");
@@ -216,9 +215,6 @@ pub struct Process {
216215
pub redirect: Option<Redirect>,
217216
#[serde(rename = "process")]
218217
pub process_type: ProcessType,
219-
#[serde(deserialize_with = "deserialize_option_duration")]
220-
#[serde(default)]
221-
pub startup_grace: Option<Duration>,
222218
}
223219

224220
#[derive(Debug, Deserialize, PartialEq, Serialize)]

src/lib.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -567,18 +567,10 @@ pub async fn run<'a>(
567567
) -> anyhow::Result<DatasetRows> {
568568
let mut processes_to_observe = exec_plan.external_processes_to_observe.unwrap_or(vec![]); // external procs to observe are cloned here.
569569

570-
// Set as minimum grace period, keeping it to stay backwards compatibile
571-
let mut max_grace_millis = 2000_u64;
572570
// run the application if there is anything to run
573571
if !exec_plan.processes_to_execute.is_empty() {
574572
for proc in exec_plan.processes_to_execute {
575573
print!("> starting process {}", proc.name.green());
576-
if let Some(startup_grace) = proc.startup_grace {
577-
let millis = startup_grace.as_millis() as u64;
578-
if millis > max_grace_millis {
579-
max_grace_millis = millis;
580-
}
581-
}
582574

583575
let process_to_observe = run_process(proc)?;
584576

@@ -589,9 +581,9 @@ pub async fn run<'a>(
589581
}
590582
}
591583

592-
print!("> waiting for application to settle: {}ms",max_grace_millis);
584+
print!("> waiting for application to settle");
593585
std::io::stdout().flush()?;
594-
tokio::time::sleep(tokio::time::Duration::from_millis(max_grace_millis)).await;
586+
tokio::time::sleep(tokio::time::Duration::from_millis(2000)).await;
595587
println!(" {}", "\t✓".green());
596588

597589
let start_time = Utc::now().timestamp_millis();
@@ -818,7 +810,6 @@ pub mod tests {
818810
down: None,
819811
redirect: Some(Redirect::Null),
820812
process_type: ProcessType::BareMetal,
821-
startup_grace: None,
822813
};
823814
let proc_to_observe = run_process(&proc)?;
824815

@@ -852,7 +843,6 @@ pub mod tests {
852843
down: None,
853844
redirect: Some(Redirect::Null),
854845
process_type: ProcessType::BareMetal,
855-
startup_grace: None,
856846
};
857847
let procs_to_observe = run_process(&proc)?;
858848
let stop_handle = metrics_logger::start_logging(vec![procs_to_observe])?;

0 commit comments

Comments
 (0)