I'd like to suggest a support for negative <work_buf_additional_days> in global preferences, with meaning "cache by that many days less work", because "during the specified w_b_min_days off-line period, the computers will be possibly not crunching for (-additional_days) long".
As the work_buf_additional_days value is used solely for calculating the amount of work to be fetched, its negative value does not break current client logic, as long as work_buf_additional_days is at least a bit larger than work_buf_min_days (for a non-negative amount of work to be kept during the work_buf_additional_days time interval.
I've tested following patch on 5.1.45 for the idea (usage of the mentioned variables seems to be identical in the 6.1.x trunk):
Index: C:/Work/Peter/Other/Proj/Boinc/SVN/5_10_45/lib/prefs.C
===================================================================
--- C:/Work/Peter/Other/Proj/Boinc/SVN/5_10_45/lib/prefs.C (revision 15010)
+++ C:/Work/Peter/Other/Proj/Boinc/SVN/5_10_45/lib/prefs.C (working copy)
@@ -413,11 +413,15 @@
if (!is_tag) continue;
if (!strcmp(tag, "global_preferences")) continue;
if (!strcmp(tag, "/global_preferences")) {
+ if (work_buf_additional_days < -work_buf_min_days)
+ work_buf_additional_days = -work_buf_min_days+0.00001;
return 0;
}
if (in_venue) {
if (!strcmp(tag, "/venue")) {
if (in_correct_venue) {
+ if (work_buf_additional_days < -work_buf_min_days)
+ work_buf_additional_days = -work_buf_min_days+0.00001;
return 0;
} else {
in_venue = false;
@@ -502,10 +506,13 @@
if (xp.parse_double(tag, "work_buf_min_days", work_buf_min_days)) {
if (work_buf_min_days < 0.00001) work_buf_min_days = 0.00001;
mask.work_buf_min_days = true;
+ if (mask.work_buf_additional_days)
+ if (work_buf_additional_days < -work_buf_min_days) work_buf_additional_days = -work_buf_min_days+0.00001;
continue;
}
if (xp.parse_double(tag, "work_buf_additional_days", work_buf_additional_days)) {
- if (work_buf_additional_days < 0) work_buf_additional_days = 0;
+ if (mask.work_buf_min_days)
+ if (work_buf_additional_days < -work_buf_min_days) work_buf_additional_days = -work_buf_min_days+0.00001;
mask.work_buf_additional_days = true;
continue;
}
Initially, to let the idea work, it was enough allowing negative values for work_buf_additional_days with following patch:
if (xp.parse_double(tag, "work_buf_additional_days", work_buf_additional_days)) {
- if (work_buf_additional_days < 0) work_buf_additional_days = 0;
mask.work_buf_additional_days = true;
continue;
}
but too negative value could break the work fetch logic.
Adding additional checks in the if (xp.parse_double(tag, "work_buf_***_days", work_buf_***_days)) ... blocks was not enough, because the order of the parameters in preferences file is not fixed or one of them could be left out completely. (BTW, this overlong line seems to reveal some trac wiki formatting bug, at least during preview.)
Possibly both checks in the parse blocks could be left out, keeping just the two checks at the beginning of the while() loop just prior to return 0; lines.