This commit is contained in:
Mateusz Gruszczyński committed 2026-10-07 22:22:54 +02:00
1 parent e84df445c6
commit e87a382a7e
109 files changed
+1092 -2925

No files matched your search

+14 -7
View File
@@ -150,6 +150,13 @@ impl Cache {
key: storage_key,
generation: entry.generation,
};
let Some(metadata) = read_cold_metadata(&storage_key, &entry).await else {
self.counters.cold_errors.fetch_add(1, Ordering::Relaxed);
if let Some(entry) = self.take_cold(&storage_key) {
self.delete_cold_entry(entry);
}
return None;
};
if entry.body_bytes > settings.max_object_bytes {
self.counters
.memory_pressure_rejections
@@ -203,7 +210,7 @@ impl Cache {
let hits = entry.hits.saturating_add(1);
let cost = hot_entry_cost(
body_allocated,
&entry.headers,
&metadata.headers,
&entry.vary,
&entry.scope,
&entry.scheme,
@@ -212,8 +219,8 @@ impl Cache {
&entry.path,
&entry.target,
&entry.tags,
entry.origin_etag.as_ref(),
entry.origin_last_modified.as_ref(),
metadata.origin_etag.as_ref(),
metadata.origin_last_modified.as_ref(),
);
let resident_age_seconds = cold_resident_age(&entry);
let hot_entry = Entry {
@@ -227,7 +234,7 @@ impl Cache {
target: entry.target.clone(),
tags: entry.tags.clone(),
created_at: entry.created_at,
headers: entry.headers.clone(),
headers: metadata.headers.clone(),
body: body.clone(),
body_allocated,
received: Instant::now(),
@@ -240,8 +247,8 @@ impl Cache {
stale_if_error: entry.stale_if_error,
must_revalidate: entry.must_revalidate,
proxy_revalidate: entry.proxy_revalidate,
origin_etag: entry.origin_etag.clone(),
origin_last_modified: entry.origin_last_modified.clone(),
origin_etag: metadata.origin_etag.clone(),
origin_last_modified: metadata.origin_last_modified.clone(),
cost,
sequence: 0,
hits,
@@ -253,7 +260,7 @@ impl Cache {
return None;
}
let mut response = Response::new(Body::from(body.clone()));
*response.headers_mut() = entry.headers;
*response.headers_mut() = metadata.headers;
if entry.transformed {
response
.extensions_mut()