diff options
author | Christopher Baines <mail@cbaines.net> | 2019-07-16 18:20:02 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-07-16 18:20:02 +0100 |
commit | 413ef9ea6eb867c93abbaa26ade7f00232e289c9 (patch) | |
tree | 35d683cc107eb51f8937f18848100c75c474706c /guix-data-service/jobs.scm | |
parent | 6904547bf2dc9dae516af3911b1dd967ae7d47a6 (diff) | |
download | data-service-413ef9ea6eb867c93abbaa26ade7f00232e289c9.tar data-service-413ef9ea6eb867c93abbaa26ade7f00232e289c9.tar.gz |
Prioritise processing the latest revisions for branches
Reserve some capacity to process revisions which are the tip of a branch. This
should reduce the time between new revisions appearing, and then being
processed.
Diffstat (limited to 'guix-data-service/jobs.scm')
-rw-r--r-- | guix-data-service/jobs.scm | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/guix-data-service/jobs.scm b/guix-data-service/jobs.scm index dd680d0..25097f8 100644 --- a/guix-data-service/jobs.scm +++ b/guix-data-service/jobs.scm @@ -129,12 +129,17 @@ #f) ((jobs ...) (for-each - (lambda (job-args) - (let ((current-processes - (hash-count (const #t) processes))) - (when (< current-processes - max-processes) - (fork-and-process-job job-args)))) + (match-lambda + ((job-id priority?) + (let ((current-processes + (hash-count (const #t) processes))) + (when (< current-processes + (if priority? + ;; For priority jobs, burst up to twice the number + ;; of max processes + (* 2 max-processes) + max-processes)) + (fork-and-process-job (list job-id)))))) jobs))) (unless (eq? 0 (sleep 15)) (exit 0)))) |