remove cache feature

This commit is contained in:
yggverse 2026-03-27 11:24:32 +02:00
parent c821fa7492
commit bbf7e73f11
5 changed files with 17 additions and 158 deletions

View file

@ -63,27 +63,13 @@ async fn api_rules(rules: &State<Arc<Rules>>) -> Result<Json<Vec<String>>, Statu
Ok(Json(result))
}
#[rocket::get("/api/cache/clean")]
async fn api_cache_clean(rules: &State<Arc<Rules>>) -> Result<Json<Option<Vec<String>>>, Status> {
let result = rules.cache_clean().await;
info!("Clean cache file: {result:?}");
Ok(Json(result.map_err(|e| {
error!("Could not handle cache clean request: `{e}`");
Status::InternalServerError
})?))
}
#[rocket::launch]
async fn rocket() -> _ {
env_logger::init();
let opt: &'static Opt = Box::leak(Box::new(Opt::from_args()));
let rules = Arc::new(
Rules::from_opt(&opt.allow_list, opt.cache.clone())
.await
.unwrap(),
);
let rules = Arc::new(Rules::from_opt(&opt.allow_list).await.unwrap());
let totals = Arc::new(Total::with_rules(rules.rules().await));
@ -108,14 +94,7 @@ async fn rocket() -> _ {
.manage(Instant::now())
.mount(
"/",
rocket::routes![
index,
api_totals,
api_allow,
api_block,
api_rules,
api_cache_clean
],
rocket::routes![index, api_totals, api_allow, api_block, api_rules],
)
}