Skip to content

Commit f51b849

Browse files
committed
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 <[email protected]>
1 parent 77529c4 commit f51b849

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

builtin/gc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2393,11 +2393,11 @@ static int systemd_timer_write_timer_file(enum schedule_priority schedule,
23932393

23942394
switch (schedule) {
23952395
case SCHEDULE_HOURLY:
2396-
schedule_pattern = xstrfmt("*-*-* *:%02d:00", minute);
2396+
schedule_pattern = xstrfmt("*-*-* 1..23:%02d:00", minute);
23972397
break;
23982398

23992399
case SCHEDULE_DAILY:
2400-
schedule_pattern = xstrfmt("*-*-* 0:%02d:00", minute);
2400+
schedule_pattern = xstrfmt("Tue..Sun *-*-* 0:%02d:00", minute);
24012401
break;
24022402

24032403
case SCHEDULE_WEEKLY:

0 commit comments

Comments
 (0)