guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]


From: Ludovic Courtès
Date: Fri, 22 Dec 2023 11:52:47 -0500 (EST)

branch: master
commit 3ed995e073cf1207d531c04904d675f4a7aebf36
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Fri Dec 22 17:52:06 2023 +0100

    remote-worker: Add randomness to the sleep delay.
    
    * src/cuirass/scripts/remote-worker.scm (start-worker): Introduce some
    randomness in the argument to ‘sleep’.
---
 src/cuirass/scripts/remote-worker.scm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/cuirass/scripts/remote-worker.scm 
b/src/cuirass/scripts/remote-worker.scm
index 83f458a..d4f39fd 100644
--- a/src/cuirass/scripts/remote-worker.scm
+++ b/src/cuirass/scripts/remote-worker.scm
@@ -395,7 +395,15 @@ process can use up to PARALLELISM cores."
                    (('no-build)
                     (log-info (G_ "~a: no available build.")
                               (worker-name worker))
-                    (sleep (%request-period)))
+
+                    ;; Sleep for a slightly random amount of time to avoid a
+                    ;; situation where all workers ask for work at the same
+                    ;; time, which could lead to this machine grabbing N jobs
+                    ;; at once even though they could have been spread across
+                    ;; several machines.
+                    (let ((delta (- (random (%request-period))
+                                    (quotient (%request-period) 2))))
+                      (sleep (+ (%request-period) delta))))
                    (command
                     (log-debug (G_ "~a: received command: ~s")
                                (worker-name wrk) command)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]