main: Add a randomized delay before fetching feeds
This commit is contained in:
@ -63,6 +63,11 @@ async fn main() -> anyhow::Result<()> {
|
||||
tokio::spawn(async move {
|
||||
|
||||
loop {
|
||||
let delay = rand::random::<u64>() % (feed_config.delay / 5);
|
||||
|
||||
debug!("Adding randomized delay: {}", delay);
|
||||
sleep(Duration::from_secs(delay)).await;
|
||||
|
||||
let feed: Option<_> = match fetch_and_parse_feed(&feed_config.url).await {
|
||||
Ok(f) => Some(f),
|
||||
Err(e) => {
|
||||
|
Reference in New Issue
Block a user