Skip to content

Commit

Permalink
Merge pull request #70 from huihuimoe/2.x
Browse files Browse the repository at this point in the history
Fix min_interval overflow
  • Loading branch information
iovxw committed May 2, 2020
2 parents 2d63190 + 16e44cf commit 594fdb3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn start(bot: Bot, db: Arc<Mutex<Database>>, min_interval: u32, max_interval
let feeds = db.lock().unwrap().all_feeds();
for feed in feeds {
let feed_interval = cmp::min(
feed.ttl.map(|ttl| ttl * 60).unwrap_or(min_interval),
cmp::max(feed.ttl.map(|ttl| ttl * 60).unwrap_or(min_interval), min_interval),
max_interval,
) as u64 - 1; // after -1, we can stagger with `interval`
queue.enqueue(feed, Duration::from_secs(feed_interval));
Expand Down

0 comments on commit 594fdb3

Please sign in to comment.