fix(scheduled_tasks): replace broken time parsing code with cron library

This commit is contained in:
alyssa 2025-01-02 00:27:30 +00:00
parent 8d53021863
commit 31c0253b00
2 changed files with 5 additions and 2 deletions

View file

@ -55,7 +55,10 @@ async fn cleanup_job(pool: sqlx::PgPool, bucket: Arc<s3::Bucket>) -> anyhow::Res
let mut tx = pool.begin().await?;
let image_id: Option<CleanupJobEntry> =
sqlx::query_as("select id from image_cleanup_jobs for update skip locked limit 1;")
sqlx::query_as(r#"
select id from image_cleanup_jobs
where ts < now() - interval '1 day'
for update skip locked limit 1;"#)
.fetch_optional(&mut *tx)
.await?;
if image_id.is_none() {