From: "Ludovic Courtès" <ludo@gnu.org>
To: 55792@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#55792] [PATCH 3/3] hydra: web: Make mcron job derivations deterministic.
Date: Sat, 4 Jun 2022 10:37:36 +0200 [thread overview]
Message-ID: <20220604083736.22152-3-ludo@gnu.org> (raw)
In-Reply-To: <20220604083736.22152-1-ludo@gnu.org>
The result of (hash config period) varies between runs. Thus, starting
from bdb914a1242cb0c00957050c96d1e279d2eb5dec, each run of "guix system
build -d ..." would produce a different derivation.
This commit fixes that.
* hydra/modules/sysadmin/web.scm (static-web-site-mcron-jobs)[record->list]:
New procedure.
Use it.
---
hydra/modules/sysadmin/web.scm | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/hydra/modules/sysadmin/web.scm b/hydra/modules/sysadmin/web.scm
index e04ac1b..f26ed24 100644
--- a/hydra/modules/sysadmin/web.scm
+++ b/hydra/modules/sysadmin/web.scm
@@ -179,11 +179,19 @@ that's built with Haunt or similar."
(basename
(static-web-site-configuration-directory config)))))
+ (define (record->list record)
+ (let ((fields (record-type-fields <static-web-site-configuration>)))
+ (map (lambda (n)
+ (struct-ref record n))
+ (iota (length fields)))))
+
(map (lambda (config)
;; Add an offset to spread web site updates over the period to avoid I/O
- ;; load peaks when there are several such jobs.
+ ;; load peaks when there are several such jobs. Compute a hash over
+ ;; a list representation of CONFIG, rather than over CONFIG, because
+ ;; hash of a struct depends on the object identity of its vtable.
(let* ((period (static-web-site-configuration-period config))
- (offset (hash config period)))
+ (offset (hash (record->list config) period)))
#~(job (lambda (now)
(let ((elapsed (modulo now #$period)))
(+ now (- #$period elapsed) #$offset)))
--
2.36.1
next prev parent reply other threads:[~2022-06-04 8:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-04 8:36 [bug#55792] [PATCH 0/3 maintenance] Web site at 10years.guix.gnu.org Ludovic Courtès
2022-06-04 8:37 ` [bug#55792] [PATCH 1/3] hydra: dns: Add entry for '10years' Ludovic Courtès
2022-06-04 8:37 ` [bug#55792] [PATCH 2/3] hydra: bayfront: Serve the 10years.guix.gnu.org web site Ludovic Courtès
2022-06-04 8:37 ` Ludovic Courtès [this message]
2022-06-04 21:13 ` [bug#55792] [PATCH 0/3 maintenance] Web site at 10years.guix.gnu.org Tobias Geerinckx-Rice via Guix-patches via
2022-06-06 13:03 ` Ludovic Courtès
2022-06-06 13:38 ` bug#55792: " Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220604083736.22152-3-ludo@gnu.org \
--to=ludo@gnu.org \
--cc=55792@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).