Re: [PATCH 6/6] maintenance: use random minute in systemd scheduler
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Aug 8, 2023, 20:05 UTC
- Message-ID
- <ZNKgBMg+bU4k+9fU@nand.local>
- In-Reply-To
- <2db943c3-2ec2-4b7e-a161-a7c9b3f04d36@github.com>
On Tue, Aug 08, 2023 at 09:49:40AM -0400, Derrick Stolee wrote:
Show 7 quoted lines
> > But I figured I'd raise the question in case you did mean for them to > > both run on either Sunday or Monday. > > I don't intend to change the day that is run as part of this change. > > I think all other schedulers run on Sunday, but systemd running on Monday > is a particular detail of its "weekly" schedule.
No problem -- I figured that you didn't intend on changing the days around here, just wanted to make sure it was known that the systemd scheduler picks a different day of the week for its weekly schedule than the others do.
Show 17 quoted lines
> >> -static int systemd_timer_write_unit_templates(const char *exec_path)
> >> +static int systemd_timer_write_unit_template(enum schedule_priority schedule,
> >> + const char *exec_path,
> >> + int minute)
> >> {
> >> char *filename;
> >> FILE *file;
> >> const char *unit;
> >> + char *schedule_pattern = NULL;
> >
> > You should be able to drop the NULL initialization, since you assign
> > this value unconditionally in the switch statement below (or BUG() on an
> > unknown schedule type).
>
> Unfortunately, GCC complained about a possibly-unassigned value when I
> left this unset during development, so this actually is necessary for
> that compiler.Ah, I would have thought that GCC would be smart enough to figure out that schedule_pattern is unconditionally initialized via the switch statement, but I guess not. Makes sense.
Thanks, Taylor