mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-03 06:31:42 +01:00
Address CodeRabbit review: keep the scratch test's one-byte budget through eviction
The session's memory worker refreshes the tile budget from the preferences every two seconds; a refresh between configure and settle could leave tiles resident. Set the budget again until a settle has emptied memory (bounded). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
2f0ac3215f
commit
ad131b391e
1 file changed
+11
-3
@@ -47,9 +47,17 @@ fn artboard_exports_refuse_unreadable_scratch_tiles() {
|
||||
std::fs::remove_file(entry.unwrap().path()).unwrap();
|
||||
}
|
||||
|
||||
// Force every tile to disk, then damage only this test's scratch file.
|
||||
spill::configure(Some(&scratch), 1).unwrap();
|
||||
spill::settle();
|
||||
// Force every tile to disk, then damage only this test's scratch file. The session's memory
|
||||
// worker refreshes the budget from the preferences every two seconds; a refresh between
|
||||
// `configure` and `settle` would leave tiles resident, so set the one-byte budget again until
|
||||
// a settle has emptied memory (bounded).
|
||||
for _ in 0..20 {
|
||||
spill::configure(Some(&scratch), 1).unwrap();
|
||||
spill::settle();
|
||||
if spill::stats().resident_bytes == 0 {
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert_eq!(spill::stats().resident_bytes, 0);
|
||||
let mut file = spill::scratch_handle_for_tests().unwrap();
|
||||
file.seek(SeekFrom::Start(0)).unwrap();
|
||||
|
||||
Reference in new issue
Block a user