From: Phillip Wood Date: Wed, 09 Aug 2023 10:03:15 GMT Subject: Re: [PATCH 6/6] maintenance: use random minute in systemd scheduler Message-ID: <44b7c1d7-83f3-c549-aa5f-2f06276ba599@gmail.com> In-Reply-To: <5bb4313a-01f3-4dea-b724-fb41a8def334@github.com> On 08/08/2023 18:24, Derrick Stolee wrote: > 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. Oops, well spotted >>> 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? Yes, having read it again - sorry I'd misunderstood it yesterday. > The overlap _definitely_ exists in systemd, which I will fix. That's great Best Wishes Phillip