aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2022-10-22 10:03:34 +0100
committerChristopher Baines <mail@cbaines.net>2022-10-22 10:03:34 +0100
commit6cd8bd854332301edef6eee68080881b8349d768 (patch)
treee9f486fa7af1f259cfb9105f0ccfd42da007e5b8
parent64d14ab709fe02bb7bcfebbfe4304af781811b43 (diff)
downloadbuild-coordinator-6cd8bd854332301edef6eee68080881b8349d768.tar
build-coordinator-6cd8bd854332301edef6eee68080881b8349d768.tar.gz
Switch to using = for testing numerical equality
As I think I've been abusing eq?.
-rw-r--r--guix-build-coordinator/agent-messaging/http.scm17
-rw-r--r--guix-build-coordinator/agent.scm10
-rw-r--r--guix-build-coordinator/datastore/sqlite.scm12
-rw-r--r--guix-build-coordinator/utils.scm4
-rw-r--r--scripts/guix-build-coordinator.in2
5 files changed, 21 insertions, 24 deletions
diff --git a/guix-build-coordinator/agent-messaging/http.scm b/guix-build-coordinator/agent-messaging/http.scm
index 45711de..b7b1877 100644
--- a/guix-build-coordinator/agent-messaging/http.scm
+++ b/guix-build-coordinator/agent-messaging/http.scm
@@ -161,7 +161,7 @@
,@headers))))
(let ((code (response-code response)))
(cond
- ((eq? code 400)
+ ((= code 400)
(and=> (coordinator-handle-failed-request log
method
path
@@ -172,7 +172,7 @@
(make-agent-error-from-coordinator
(assoc-ref error "error"))))))
- ((eq? code 404)
+ ((= code 404)
(values
(and body (json-string->scm (utf8->string body)))
response))
@@ -227,7 +227,7 @@
#:decode-body? #f)))
(let ((code (response-code response)))
(cond
- ((eq? code 400)
+ ((= code 400)
(and=> (coordinator-handle-failed-request log
method
path
@@ -293,8 +293,7 @@
"/output/" output-name
"/partial")
#:method 'HEAD)))
- (if (eq? (response-code response)
- 404)
+ (if (= (response-code response) 404)
#f
(response-content-length response))))
@@ -306,8 +305,7 @@
(string-append "/build/" build-id
"/output/" output-name)
#:method 'HEAD)))
- (if (eq? (response-code response)
- 404)
+ (if (= (response-code response) 404)
#f
(response-content-length response))))
@@ -336,8 +334,7 @@
(or partial-upload-bytes
completed-upload-bytes))))
;; Check if the server has all the bytes
- (if (and bytes
- (eq? bytes file-size))
+ (if (and bytes (= bytes file-size))
(begin
(log 'DEBUG "perform upload: server has all the bytes"
" (partial-upload-bytes: " partial-upload-bytes
@@ -418,7 +415,7 @@
(unless (and=>
(get-completed-upload-bytes)
(lambda (uploaded-bytes)
- (eq? uploaded-bytes file-size)))
+ (= uploaded-bytes file-size)))
(retry-on-error perform-upload
#:times 100
#:delay 40
diff --git a/guix-build-coordinator/agent.scm b/guix-build-coordinator/agent.scm
index c06987a..6c01617 100644
--- a/guix-build-coordinator/agent.scm
+++ b/guix-build-coordinator/agent.scm
@@ -518,7 +518,7 @@
(log-msg lgr 'INFO
"starting " (length new-builds)
" new "
- (if (eq? (length new-builds) 1) "build" "builds"))
+ (if (= (length new-builds) 1) "build" "builds"))
(for-each
(lambda (job-args)
(process-job-with-queue job-args))
@@ -735,7 +735,7 @@ but the guix-daemon claims it's unavailable"
#t
(lambda ()
(log-msg lgr 'DEBUG build-id ": deleting "
- (if (eq? (length output-file-names) 1)
+ (if (= (length output-file-names) 1)
"output"
"outputs"))
;; There can be issues deleting links when collecting garbage
@@ -808,11 +808,11 @@ but the guix-daemon claims it's unavailable"
(lambda (exn)
(if (store-protocol-error? exn)
(cond
- ((eq? (store-protocol-error-status exn) 1)
+ ((= (store-protocol-error-status exn) 1)
(log-msg lgr 'INFO build-id ": build failed"))
- ((eq? (store-protocol-error-status exn) 100)
+ ((= (store-protocol-error-status exn) 100)
(log-msg lgr 'INFO build-id ": build failed (permanent failure)"))
- ((eq? (store-protocol-error-status exn) 101)
+ ((= (store-protocol-error-status exn) 101)
(log-msg lgr 'INFO build-id ": build failed due to a timeout"))
(else
(log-msg lgr 'ERROR build-id ": unknown store protocol error: "
diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm
index 2f3aa21..be5dc98 100644
--- a/guix-build-coordinator/datastore/sqlite.scm
+++ b/guix-build-coordinator/datastore/sqlite.scm
@@ -613,7 +613,7 @@ SELECT id, name, description, active FROM agents ORDER BY id"
`((uuid . ,id)
(name . ,name)
(description . ,description)
- (active . ,(eq? active 1)))))
+ (active . ,(= active 1)))))
statement)))
(sqlite-reset statement)
@@ -1427,7 +1427,7 @@ WHERE build_id = :build_id"
(sqlite-reset statement)
(values derived-priority
- (eq? 1 all-inputs-built))))))
+ (= 1 all-inputs-built))))))
(define (db-update-build-priority db build-id new-priority)
(let ((statement
@@ -1562,7 +1562,7 @@ DELETE FROM build_allocation_plan WHERE build_id = :build_id"
(sqlite-step statement)
(sqlite-reset statement)
- (unless (eq? 0 (changes-count db))
+ (unless (= 0 (changes-count db))
(update-build-allocation-plan-metrics)))))
#t)
@@ -3593,8 +3593,8 @@ WHERE name = :name"
(#(system fixed_output)
`((system . ,system)
(fixed-output? . ,(cond
- ((eq? fixed_output 0) #f)
- ((eq? fixed_output 1) #t)
+ ((= fixed_output 0) #f)
+ ((= fixed_output 1) #t)
(else fixed_output))))))))
(sqlite-reset statement)
@@ -3676,7 +3676,7 @@ WHERE derivation_id = :derivation_id"
(name . ,name)
(hash-algorithm . ,hash-algorithm)
(hash . ,hash)
- (recursive? . ,(eq? 1 recursive)))))
+ (recursive? . ,(= 1 recursive)))))
statement)))
(sqlite-reset statement)
diff --git a/guix-build-coordinator/utils.scm b/guix-build-coordinator/utils.scm
index 961e225..7eb6dfe 100644
--- a/guix-build-coordinator/utils.scm
+++ b/guix-build-coordinator/utils.scm
@@ -320,12 +320,12 @@ upcoming chunk."
(parameterize
((current-read-waiter
(lambda (port)
- (when (eq? (port-poll port "r" timeout) 0)
+ (when (= (port-poll port "r" timeout) 0)
(raise-exception
(make-port-timeout-error)))))
(current-write-waiter
(lambda (port)
- (when (eq? (port-poll port "w" timeout) 0)
+ (when (= (port-poll port "w" timeout) 0)
(raise-exception
(make-port-timeout-error))))))
(thunk)))
diff --git a/scripts/guix-build-coordinator.in b/scripts/guix-build-coordinator.in
index 17c8385..e97134e 100644
--- a/scripts/guix-build-coordinator.in
+++ b/scripts/guix-build-coordinator.in
@@ -892,7 +892,7 @@ tags:
(simple-format #t " derived priority: ~A\n"
(assoc-ref build "derived_priority"))
(let ((tags (assoc-ref build "tags")))
- (unless (eq? 0 (vector-length tags))
+ (unless (= 0 (vector-length tags))
(simple-format #t " tags:\n")
(vector-for-each
(lambda (_ tag)