From: Derrick Stolee Date: Tue, 08 Aug 2023 17:24:54 GMT Subject: Re: [PATCH 6/6] maintenance: use random minute in systemd scheduler Message-ID: <5bb4313a-01f3-4dea-b724-fb41a8def334@github.com> In-Reply-To: <8aa7be24-f4a8-4515-8425-dd4bc69e07b1@github.com> On 8/8/2023 9:56 AM, Derrick Stolee wrote: > On 8/8/2023 5:53 AM, Phillip Wood wrote:> Hi Stolee >> So only one of these jobs will succeed. The cron entries are careful to >> only run one job at a time, I think it would be worth doing the same >> thing here. I think the using the following format strings would fix this. >> >> Hourly: "Tue..Sun *-*-* 1..23:00:%02d" >> Daily: "Tue..Sun *-*-* 00:00:%02d" >> Weekly: "Mon *-*-* 00:00:%02d" > > I would modify this with dropping the "Tue..Sun" from the hourly schedule, > as we still want 23 runs on Mondays. > >> It looks like the launchctl schedule has the same issue. > > I will take a look at this and consider some additional patches to correct > these issues across both schedulers. Thank you for the attention to detail! Taking a look, it seems that launchctl does not have this same problem. The schedule is set via an of s as follows: case SCHEDULE_HOURLY: repeat = "\n" "Hour%d\n" "Minute%d\n" "\n"; for (i = 1; i <= 23; i++) strbuf_addf(&plist, repeat, i, minute); break; case SCHEDULE_DAILY: repeat = "\n" "Day%d\n" "Hour0\n" "Minute%d\n" "\n"; for (i = 1; i <= 6; i++) strbuf_addf(&plist, repeat, i, minute); break; This means that we create an hourly schedule for each hour 1..23 (no 0th hour means no collision with daily or weekly schedule) and a daily schedule for each day 1..6 (no 0th day means no collision with the weekly schedule). Does this match your understanding? The overlap _definitely_ exists in systemd, which I will fix. Thanks, -Stolee