mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-20 03:57:03 +00:00
Fetcher: separate init() from start() [start may rerun everytime we go online]
This commit is contained in:
parent
3e882b7416
commit
5eb9d46187
@ -47,7 +47,7 @@ impl Fetcher {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn start() -> Result<(), Error> {
|
||||
pub(crate) fn init() -> Result<(), Error> {
|
||||
// Setup the cache directory
|
||||
*GLOBALS.fetcher.cache_dir.write().unwrap() = Profile::current()?.cache_dir;
|
||||
|
||||
@ -68,6 +68,10 @@ impl Fetcher {
|
||||
.build()?,
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn start() {
|
||||
// Setup periodic queue management
|
||||
let fetcher_looptime_ms = GLOBALS.storage.read_setting_fetcher_looptime_ms();
|
||||
tokio::task::spawn(async move {
|
||||
@ -83,9 +87,9 @@ impl Fetcher {
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Ok(())
|
||||
tracing::info!("Fetcher shutdown");
|
||||
});
|
||||
}
|
||||
|
||||
/// Count of HTTP requests queued for future fetching
|
||||
|
@ -186,8 +186,11 @@ impl Overlord {
|
||||
.feed
|
||||
.set_feed_starts(general_feed_start, person_feed_start, inbox_feed_start);
|
||||
|
||||
// Init the fetcher
|
||||
crate::fetcher::Fetcher::init()?;
|
||||
|
||||
// Start the fetcher
|
||||
crate::fetcher::Fetcher::start()?;
|
||||
crate::fetcher::Fetcher::start();
|
||||
|
||||
// Start periodic tasks in people manager (after signer)
|
||||
crate::people::People::start();
|
||||
|
Loading…
Reference in New Issue
Block a user