mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-21 18:01:07 +01:00
Disk cache: an entry larger than the cache is skipped before it is sealed (#3750 review)
This commit is contained in:
1 parent
c2c40200f6
commit
f6a867a951
1 file changed
+4
-4
@@ -1106,13 +1106,13 @@ impl DiskCache {
|
||||
self.write_failed(&e);
|
||||
return;
|
||||
}
|
||||
// An entry that cannot fit would be evicted straight away (asked before it is sealed).
|
||||
if payload.len().saturating_add(16) as u64 > self.limit_bytes() {
|
||||
return;
|
||||
}
|
||||
// (no memory for the sealed entry just now: it isn't written; a plane is decoded from its
|
||||
// file next time)
|
||||
let Some(data) = try_seal_format(kind, format, payload) else { return };
|
||||
// An entry that cannot fit would be evicted straight away.
|
||||
if data.len() as u64 > self.limit_bytes() {
|
||||
return;
|
||||
}
|
||||
// Make room first, so the cache never exceeds its limit (or the free-space reserve).
|
||||
self.evict_to(self.limit_bytes().saturating_sub(data.len() as u64));
|
||||
let n = self.tmp_counter.fetch_add(1, Ordering::Relaxed);
|
||||
|
||||
Reference in new issue
Block a user