hours instead of days

This commit is contained in:
Brandon Thomas committed 2026-04-12 17:17:43 -04:00
1 parent 629dd1f8d9
commit 97b8051daf
2 files changed
+6 -5

No files matched your search

@@ -134,8 +134,8 @@ async fn run_poll_iteration(deps: &JobDependencies) -> anyhow::Result<()> {
let order_age = Utc::now() - last_order_created;
let too_old = order_age > *max_age;
if too_old {
info!("Last order on page {} is {} days old (threshold: {} days). Stopping pagination.",
total_page_number, order_age.num_days(), max_age.num_days());
info!("Last order on page {} is {} hours old (threshold: {} hours). Stopping pagination.",
total_page_number, order_age.num_hours(), max_age.num_hours());
exceeded_max_age = true;
}
}
@@ -43,6 +43,7 @@ const ENV_REGION_NAME: &str = "REGION_NAME";
const ENV_PUBLIC_BUCKET_NAME: &str = "PUBLIC_BUCKET_NAME";
const ENV_S3_ENDPOINT: &str = "S3_COMPATIBLE_ENDPOINT_URL";
const ENV_SEEDANCE2PRO_COOKIES : &str = "SEEDANCE2PRO_COOKIES";
const ENV_MAX_JOB_AGE_THRESHOLD_HOURS: &str = "MAX_JOB_AGE_THRESHOLD_HOURS";
#[tokio::main]
async fn main() -> AnyhowResult<()> {
@@ -113,11 +114,11 @@ async fn main() -> AnyhowResult<()> {
info!("Batch page count: {}", count);
}
let maybe_max_job_age = easyenv::try_get_env_num_optional::<i64>("MAX_JOB_AGE_THRESHOLD_DAYS")?
.and_then(chrono::Duration::try_days);
let maybe_max_job_age = easyenv::try_get_env_num_optional::<i64>(ENV_MAX_JOB_AGE_THRESHOLD_HOURS)?
.and_then(chrono::Duration::try_hours);
if let Some(ref duration) = maybe_max_job_age {
info!("Max job age threshold: {} days", duration.num_days());
info!("Max job age threshold: {} hours", duration.num_hours());
}
let (pager, pager_worker) = build_pager(server_environment, &container_environment.hostname);