maintenance: fix systemd schedule overlaps

The 'git maintenance run' command prevents concurrent runs in the same repository using a 'maintenance.lock' file. However, when using systemd the hourly maintenance runs the same time as the daily and weekly runs. (Similarly, daily maintenance runs at the same time as weekly maintenance.) These competing commands result in some maintenance not actually being run. This overlap was something we could not fix until we made the recent change to not use the builting 'hourly', 'daily', and 'weekly' schedules in systemd. We can adjust the schedules such that: 1. Hourly runs avoid the 0th hour. 2. Daily runs avoid Monday. This will keep maintenance runs from colliding when using systemd. Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed Aug 10, 2023 at 20:39 UTC c97ec0378b97036c62492678931a297a4498d12c
1 file changed +2 -2
builtin/gc.c
+2 -2
@@ -2350,11 +2350,11 @@ static int systemd_timer_write_timer_file(enum schedule_priority schedule,
2350
2351 switch (schedule) {
2352 case SCHEDULE_HOURLY:
2353 - schedule_pattern = xstrfmt("*-*-* *:%02d:00", minute);
2353 + schedule_pattern = xstrfmt("*-*-* 1..23:%02d:00", minute);
2354 break;
2355
2356 case SCHEDULE_DAILY:
2357 - schedule_pattern = xstrfmt("*-*-* 0:%02d:00", minute);
2357 + schedule_pattern = xstrfmt("Tue..Sun *-*-* 0:%02d:00", minute);
2358 break;
2359
2360 case SCHEDULE_WEEKLY: