From: Derrick Stolee via GitGitGadget Date: Fri, 03 Apr 2020 20:48:09 GMT Subject: [PATCH 10/15] job-runner: use config to limit job frequency Message-ID: <18429182ffcf4cb56fcf3d8c76e41652a6c45adc.1585946894.git.gitgitgadget@gmail.com> In-Reply-To: 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