From: Phillip Wood Date: Sun, 05 Apr 2020 15:24:40 GMT Subject: Re: [PATCH 10/15] job-runner: use config to limit job frequency Message-ID: In-Reply-To: <18429182ffcf4cb56fcf3d8c76e41652a6c45adc.1585946894.git.gitgitgadget@gmail.com> Hi Stolee On 03/04/2020 21:48, Derrick Stolee via GitGitGadget wrote: > From: Derrick Stolee > > We want to run different maintenance tasks at different rates. That > means we cannot rely only on the time between job-runner loop pauses > to reduce the frequency of specific jobs. This means we need to > persist a timestamp for the previous run somewhere. A natural place > is the Git config file for that repo. > > Create the job..lastRun config option to store the > timestamp of the previous run of that job. Set this config option > after a successful run of 'git -C run-job '. > > To maximize code reuse, we dynamically construct the config key > and parse the config value into a timestamp in a generic way. This > makes the introduction of another config option extremely trivial: > > The job..interval option allows a user to specify a > minimum number of seconds between two calls to 'git run-job > ' on a given repo. This could be stored in the global > or system config to provide an update on the default for all repos, > or could be updated on a per-repo basis. This is checked on every > iteration of the job loop, so a user could update this and see the > effect without restarting the job-runner process. > > RFC QUESTION: I'm using a 'git -C config