mirror of
https://git.asonix.dog/asonix/pict-rs.git
synced 2024-12-01 05:51:07 +00:00
Gate cleanup behind read-only config
This commit is contained in:
parent
13d6e10886
commit
7dc8ede8eb
1 changed files with 7 additions and 3 deletions
10
src/lib.rs
10
src/lib.rs
|
@ -1344,10 +1344,14 @@ fn configure_endpoints<
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn spawn_cleanup<R>(repo: R)
|
fn spawn_cleanup<R>(repo: R, config: &Configuration)
|
||||||
where
|
where
|
||||||
R: FullRepo + 'static,
|
R: FullRepo + 'static,
|
||||||
{
|
{
|
||||||
|
if config.server.read_only {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
tracing::trace_span!(parent: None, "Spawn task").in_scope(|| {
|
tracing::trace_span!(parent: None, "Spawn task").in_scope(|| {
|
||||||
actix_rt::spawn(async move {
|
actix_rt::spawn(async move {
|
||||||
let mut interval = actix_rt::time::interval(Duration::from_secs(30));
|
let mut interval = actix_rt::time::interval(Duration::from_secs(30));
|
||||||
|
@ -1404,7 +1408,7 @@ async fn launch_file_store<R: FullRepo + 'static, F: Fn(&mut web::ServiceConfig)
|
||||||
|
|
||||||
let address = config.server.address;
|
let address = config.server.address;
|
||||||
|
|
||||||
spawn_cleanup(repo.clone());
|
spawn_cleanup(repo.clone(), &config);
|
||||||
|
|
||||||
HttpServer::new(move || {
|
HttpServer::new(move || {
|
||||||
let client = client.clone();
|
let client = client.clone();
|
||||||
|
@ -1446,7 +1450,7 @@ async fn launch_object_store<
|
||||||
|
|
||||||
let address = config.server.address;
|
let address = config.server.address;
|
||||||
|
|
||||||
spawn_cleanup(repo.clone());
|
spawn_cleanup(repo.clone(), &config);
|
||||||
|
|
||||||
HttpServer::new(move || {
|
HttpServer::new(move || {
|
||||||
let client = client.clone();
|
let client = client.clone();
|
||||||
|
|
Loading…
Reference in a new issue