main: Fix silly logic bug in the exponential backoff code
This commit is contained in:
@ -38,7 +38,7 @@ use crate::{
|
|||||||
state::FeedReaderStateDb
|
state::FeedReaderStateDb
|
||||||
};
|
};
|
||||||
|
|
||||||
use std::{ sync::Arc, cmp::max };
|
use std::{ sync::Arc, cmp::min, cmp::max };
|
||||||
use tracing::{ info, debug, error };
|
use tracing::{ info, debug, error };
|
||||||
use chrono::DateTime;
|
use chrono::DateTime;
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let feed = if feed.is_none() {
|
let feed = if feed.is_none() {
|
||||||
backoff = max(backoff * 2, 6 * 3600);
|
backoff = min(backoff * 2, 6 * 3600);
|
||||||
error!("Backing off for {} seconds", backoff);
|
error!("Backing off for {} seconds", backoff);
|
||||||
sleep(Duration::from_secs(backoff)).await;
|
sleep(Duration::from_secs(backoff)).await;
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user