merge fix

This commit is contained in:
JMARyA 2024-04-26 18:54:05 +02:00
commit e5a18ae047
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
2 changed files with 3 additions and 2 deletions

View file

@ -8,6 +8,7 @@ RUN cargo build --release
FROM debian:buster FROM debian:buster
RUN apt update && apt upgrade -y RUN apt update && apt upgrade -y
RUN apt install -y gnupg ca-certificates openssl
COPY --from=builder /app/target/release/mirrord /mirrord COPY --from=builder /app/target/release/mirrord /mirrord

View file

@ -122,9 +122,8 @@ impl Mirror {
} }
// check if cache should be used // check if cache should be used
Self::create_cache_dir(p.parent().unwrap());
if !self.no_cache.is_match(path) || !self.is_cache_invalid(&p) { if !self.no_cache.is_match(path) || !self.is_cache_invalid(&p) {
Self::create_cache_dir(p.parent().unwrap());
// use cache if present // use cache if present
if let Some(resp) = self.fetch_cache(&p, req).await { if let Some(resp) = self.fetch_cache(&p, req).await {
log::info!("Returning {path} from cache"); log::info!("Returning {path} from cache");
@ -219,6 +218,7 @@ impl Mirror {
let status_code = response.status(); let status_code = response.status();
let body_bytes = response.bytes().await.ok()?; let body_bytes = response.bytes().await.ok()?;
if status_code.is_success() { if status_code.is_success() {
log::debug!("Writing request to {save:?}");
std::fs::write(save, &body_bytes).unwrap(); std::fs::write(save, &body_bytes).unwrap();
} }
let mut http_response = HttpResponse::build( let mut http_response = HttpResponse::build(