mirror of
https://github.com/git/git
synced 2024-09-18 07:51:35 +00:00
maintenance: use random minute in Windows scheduler
The get_random_minute() method was created to allow maintenance schedules to be fixed to a random minute of the hour. This randomness is only intended to spread out the load from a number of clients, but each client should have an hour between each maintenance cycle. Add this random minute to the Windows scheduler integration. We need only to modify the minute value for the 'StartBoundary' tag across the three schedules. Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
ec5d9d684c
commit
62a239987c
16
builtin/gc.c
16
builtin/gc.c
|
@ -1995,6 +1995,7 @@ static int schtasks_schedule_task(const char *exec_path, enum schedule_priority
|
||||||
const char *frequency = get_frequency(schedule);
|
const char *frequency = get_frequency(schedule);
|
||||||
char *name = schtasks_task_name(frequency);
|
char *name = schtasks_task_name(frequency);
|
||||||
struct strbuf tfilename = STRBUF_INIT;
|
struct strbuf tfilename = STRBUF_INIT;
|
||||||
|
int minute = get_random_minute();
|
||||||
|
|
||||||
get_schedule_cmd(&cmd, NULL);
|
get_schedule_cmd(&cmd, NULL);
|
||||||
|
|
||||||
|
@ -2015,7 +2016,7 @@ static int schtasks_schedule_task(const char *exec_path, enum schedule_priority
|
||||||
switch (schedule) {
|
switch (schedule) {
|
||||||
case SCHEDULE_HOURLY:
|
case SCHEDULE_HOURLY:
|
||||||
fprintf(tfile->fp,
|
fprintf(tfile->fp,
|
||||||
"<StartBoundary>2020-01-01T01:00:00</StartBoundary>\n"
|
"<StartBoundary>2020-01-01T01:%02d:00</StartBoundary>\n"
|
||||||
"<Enabled>true</Enabled>\n"
|
"<Enabled>true</Enabled>\n"
|
||||||
"<ScheduleByDay>\n"
|
"<ScheduleByDay>\n"
|
||||||
"<DaysInterval>1</DaysInterval>\n"
|
"<DaysInterval>1</DaysInterval>\n"
|
||||||
|
@ -2024,12 +2025,13 @@ static int schtasks_schedule_task(const char *exec_path, enum schedule_priority
|
||||||
"<Interval>PT1H</Interval>\n"
|
"<Interval>PT1H</Interval>\n"
|
||||||
"<Duration>PT23H</Duration>\n"
|
"<Duration>PT23H</Duration>\n"
|
||||||
"<StopAtDurationEnd>false</StopAtDurationEnd>\n"
|
"<StopAtDurationEnd>false</StopAtDurationEnd>\n"
|
||||||
"</Repetition>\n");
|
"</Repetition>\n",
|
||||||
|
minute);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCHEDULE_DAILY:
|
case SCHEDULE_DAILY:
|
||||||
fprintf(tfile->fp,
|
fprintf(tfile->fp,
|
||||||
"<StartBoundary>2020-01-01T00:00:00</StartBoundary>\n"
|
"<StartBoundary>2020-01-01T00:%02d:00</StartBoundary>\n"
|
||||||
"<Enabled>true</Enabled>\n"
|
"<Enabled>true</Enabled>\n"
|
||||||
"<ScheduleByWeek>\n"
|
"<ScheduleByWeek>\n"
|
||||||
"<DaysOfWeek>\n"
|
"<DaysOfWeek>\n"
|
||||||
|
@ -2041,19 +2043,21 @@ static int schtasks_schedule_task(const char *exec_path, enum schedule_priority
|
||||||
"<Saturday />\n"
|
"<Saturday />\n"
|
||||||
"</DaysOfWeek>\n"
|
"</DaysOfWeek>\n"
|
||||||
"<WeeksInterval>1</WeeksInterval>\n"
|
"<WeeksInterval>1</WeeksInterval>\n"
|
||||||
"</ScheduleByWeek>\n");
|
"</ScheduleByWeek>\n",
|
||||||
|
minute);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCHEDULE_WEEKLY:
|
case SCHEDULE_WEEKLY:
|
||||||
fprintf(tfile->fp,
|
fprintf(tfile->fp,
|
||||||
"<StartBoundary>2020-01-01T00:00:00</StartBoundary>\n"
|
"<StartBoundary>2020-01-01T00:%02d:00</StartBoundary>\n"
|
||||||
"<Enabled>true</Enabled>\n"
|
"<Enabled>true</Enabled>\n"
|
||||||
"<ScheduleByWeek>\n"
|
"<ScheduleByWeek>\n"
|
||||||
"<DaysOfWeek>\n"
|
"<DaysOfWeek>\n"
|
||||||
"<Sunday />\n"
|
"<Sunday />\n"
|
||||||
"</DaysOfWeek>\n"
|
"</DaysOfWeek>\n"
|
||||||
"<WeeksInterval>1</WeeksInterval>\n"
|
"<WeeksInterval>1</WeeksInterval>\n"
|
||||||
"</ScheduleByWeek>\n");
|
"</ScheduleByWeek>\n",
|
||||||
|
minute);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue