Skip to content

Commit 6fa2137

Browse files
committed
cull 2% more in each run (to compensate for new files being added)
If each Cull operation attempts to reach exactly BRUN / FRUN, it will fail to meet that goal because new files are being added during the Cull, and another Cull will be started right after that, which will again fail to meet the goal, leaving the daemon in an endless culling loop. Adding 2% to the configured BRUN / FRUN values is an experiment to see whether this solves the loop.
1 parent cc552fa commit 6fa2137

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

debian/changelog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
cm4all-cash (0.7) unstable; urgency=low
22

3+
* cull 2% more in each run (to compensate for new files being added)
34
* switch to C++23
45
* require Meson 1.2 (for C++23 support)
56

src/Main.cxx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,23 @@ OpenDevCachefiles(const Config &config)
5151
return fd;
5252
}
5353

54+
/**
55+
* Add 2% to the configured BRUN / FRUN values to compensate for files
56+
* being added while we're culling.
57+
*
58+
* If each Cull operation attempts to reach exactly BRUN / FRUN, it
59+
* will fail to meet that goal because new files are being added
60+
* during the Cull, and another Cull will be started right after that,
61+
* which will again fail to meet the goal, leaving the daemon in an
62+
* endless culling loop.
63+
*/
64+
static constexpr uint_least8_t RUN_PERCENT_OFFSET = 2;
65+
5466
inline
5567
Instance::Instance(const Config &config)
5668
:dev_cachefiles(event_loop, OpenDevCachefiles(config), BIND_THIS_METHOD(OnCull)),
57-
brun(config.brun), frun(config.frun),
69+
brun(config.brun + RUN_PERCENT_OFFSET),
70+
frun(config.frun + RUN_PERCENT_OFFSET),
5871
culling_disabled(config.culling_disabled)
5972
{
6073
event_loop.EnableUring(16384, IORING_SETUP_SINGLE_ISSUER|IORING_SETUP_COOP_TASKRUN);

0 commit comments

Comments
 (0)