From: Derrick Stolee <dstolee@xxxxxxxxxxxxx> The 'git job-runner' process uses a sleep(X) call to pause its operation between iterations of the job loop. This defaults to 30 minutes, but is now available to be done with longer or shorter intervals according to the job.loopInterval config option. For example, a user may want the job loop to run once every five minutes while another wants the job loop to run once every six hours. This config value is checked immediately before the sleep(X) call, which allows users to see the effect without restarting the job-runner process. However, the process will be paused until the previous sleep(X) call returns and the job loop is executed. RFC QUESITON: Is this use of sleep(X) the best way to do this? Is there a better way to delay the process for a time interval, or until a specified time? This just seemed like the simplest option. The job-runner is doing low-priority work on an unpredictable schedule by design, so sleep(X) seemd appropriate. Signed-off-by: Derrick Stolee <dstolee@xxxxxxxxxxxxx> --- Documentation/config/job.txt | 4 ++++ builtin/job-runner.c | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Documentation/config/job.txt b/Documentation/config/job.txt index 7c799d66221..772001e6744 100644 --- a/Documentation/config/job.txt +++ b/Documentation/config/job.txt @@ -1,3 +1,7 @@ +job.loopInterval:: + The number of seconds to sleep between rounds of running + background jobs in `git job-runner`. + job.<job-name>.interval:: The minimum number of seconds between runs of `git run-job <job-name>` when running `git job-runner`. diff --git a/builtin/job-runner.c b/builtin/job-runner.c index aee55c106e8..7e37b122d99 100644 --- a/builtin/job-runner.c +++ b/builtin/job-runner.c @@ -261,7 +261,11 @@ static int run_job_loop_step(struct string_list *list) static unsigned int get_loop_interval(void) { /* Default: 30 minutes */ - return 30 * 60; + timestamp_t interval = 30 * 60; + + try_get_timestamp(NULL, ".", "loopinterval", &interval); + + return interval; } static int initialize_jobs(struct string_list *list) -- gitgitgadget