Use ceil in calculating crawl_interval

So that it can increase from 1 minute.
This commit is contained in:
Tyler Hallada 2023-08-29 23:32:05 -04:00
parent 276f0e17a8
commit 69ed8aa8bb

View File

@ -206,7 +206,7 @@ impl FeedCrawler {
{ {
Ordering::Greater => { Ordering::Greater => {
feed.crawl_interval_minutes = i32::max( feed.crawl_interval_minutes = i32::max(
(feed.crawl_interval_minutes as f32 * 1.2).round() as i32, (feed.crawl_interval_minutes as f32 * 1.2).ceil() as i32,
MAX_CRAWL_INTERVAL_MINUTES, MAX_CRAWL_INTERVAL_MINUTES,
); );
info!( info!(
@ -216,7 +216,7 @@ impl FeedCrawler {
} }
Ordering::Less => { Ordering::Less => {
feed.crawl_interval_minutes = i32::max( feed.crawl_interval_minutes = i32::max(
(feed.crawl_interval_minutes as f32 / 1.2).round() as i32, (feed.crawl_interval_minutes as f32 / 1.2).ceil() as i32,
MIN_CRAWL_INTERVAL_MINUTES, MIN_CRAWL_INTERVAL_MINUTES,
); );
info!( info!(