diff --git a/adapter/cron/src/main.rs b/adapter/cron/src/main.rs index 94f17a9..644d6e8 100644 --- a/adapter/cron/src/main.rs +++ b/adapter/cron/src/main.rs @@ -57,6 +57,7 @@ fn extract_flow_setting_field(flow: &ValidationFlow, name: &str) -> Option bool { + log::debug!("Trying to identify flow with flow id: {}", flow.flow_id); let Some(minute) = extract_flow_setting_field(flow, "cronMinute") else { return false; }; @@ -73,6 +74,16 @@ impl IdentifiableFlow for Time { return false; }; + log::debug!( + "flow with id: {} has the following cron configuration {} {} {} {} {}", + flow.flow_id, + minute, + hour, + dom, + month, + dow + ); + let expression = format!("* {} {} {} {} {}", minute, hour, dom, month, dow); let schedule = match Schedule::from_str(expression.as_str()) { Ok(s) => s, @@ -93,11 +104,19 @@ impl IdentifiableFlow for Time { } }; - self.now.year() == next.year() + let is_match = self.now.year() == next.year() && self.now.month() == next.month() && self.now.day() == next.day() && self.now.hour() == next.hour() - && self.now.minute() == next.minute() + && self.now.minute() == next.minute(); + + if is_match { + log::debug!("Flow with id: {} was a match", flow.flow_id); + } else { + log::debug!("Flow with id: {} was no match", flow.flow_id); + } + + is_match } } @@ -111,7 +130,7 @@ impl Server for Cron { log::info!("Starting Cron adapter"); let expression = "0 * * * * *"; let schedule = Schedule::from_str(expression)?; - let pattern = "CRON.<"; + let pattern = "CRON.*"; loop { let now = Utc::now();