This commit is contained in:
Robin Appelman 2026-11-03 19:42:38 +01:00
commit ac55958f8c
Signed by: robin
SSH key fingerprint: SHA256:kifqgrqnut7q1YUIrI0AdMNC23qiKAS/T9uGFmIYvbE

View file

@ -5,18 +5,18 @@ mod hub;
use crate::config::{Config, FeedConfig};
use crate::error::{FetchError, FetchFeedError, HubError, ParseFeedError};
use crate::fetcher::{next_fetch, CacheHeaders, FetchPlan, FetchResponse};
use crate::fetcher::{CacheHeaders, FetchPlan, FetchResponse, next_fetch};
use main_error::MainResult;
use std::collections::hash_map::DefaultHasher;
use std::collections::HashMap;
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
use std::str::FromStr;
use std::sync::atomic::{AtomicBool, Ordering};
use std::thread::sleep;
use std::time::{Duration, Instant};
use tracing::{debug, error, info, instrument, warn};
use ureq::http::header::{HeaderValue, USER_AGENT};
use ureq::http::Response;
use ureq::http::header::{HeaderValue, USER_AGENT};
use ureq::{Agent, Body};
const FETCHER_USER_AGENT: &str = concat!(
@ -68,11 +68,11 @@ fn main_loop(config: Config) {
}
}
interruptable_sleep(config.interval());
interruptible_sleep(config.interval());
}
}
fn interruptable_sleep(duration: Duration) {
fn interruptible_sleep(duration: Duration) {
let target = Instant::now() + duration;
while Instant::now() < target && RUNNING.load(Ordering::SeqCst) {
sleep(Duration::from_millis(100));