fix removing all past items because of trying to scrape past
This commit is contained in:
parent
975193ff65
commit
146faa015b
|
|
@ -42,7 +42,7 @@ WORKDIR /app
|
|||
|
||||
RUN apk add --no-cache ca-certificates tzdata dcron tini
|
||||
|
||||
RUN echo "0 0 * * * /app/mensa-upb-scraper >> /var/log/cron.log 2>&1" \
|
||||
RUN echo "0 0/8 * * * /app/mensa-upb-scraper >> /var/log/cron.log 2>&1" \
|
||||
> /etc/crontabs/root && \
|
||||
touch /var/log/cron.log
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,11 @@ pub async fn check_refresh(db: &sqlx::PgPool, date: NaiveDate, canteens: &[Cante
|
|||
return false;
|
||||
}
|
||||
|
||||
if date < Utc::now().date_naive() {
|
||||
tracing::trace!("Not refreshing menu for date {date} as it is in the past");
|
||||
return false;
|
||||
}
|
||||
|
||||
let canteens_needing_refresh = match sqlx::query!(
|
||||
r#"SELECT canteen, max(scraped_at) AS "scraped_at!" FROM canteens_scraped WHERE canteen = ANY($1) AND scraped_for = $2 GROUP BY canteen"#,
|
||||
&canteens
|
||||
|
|
|
|||
Loading…
Reference in New Issue