diff options
author | Christopher Baines <mail@cbaines.net> | 2020-12-10 23:20:50 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-12-10 23:20:50 +0000 |
commit | 3007c1f10bd240ba5f5f69b8765c25a5d4a6e459 (patch) | |
tree | 9884a030b205f7c7e5a153530cd88b7563e1778d | |
parent | 22b2204187c7d8a0a6268ca8038b60fd5f5b825a (diff) | |
download | build-coordinator-3007c1f10bd240ba5f5f69b8765c25a5d4a6e459.tar build-coordinator-3007c1f10bd240ba5f5f69b8765c25a5d4a6e459.tar.gz |
Further fix updating the build_allocation_plan_total metric
It needs to be updated for all agents, as allocating a build for one agent can
remove it from the plan for others.
-rw-r--r-- | guix-build-coordinator/datastore/sqlite.scm | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm index 4ecd83e..3cec6df 100644 --- a/guix-build-coordinator/datastore/sqlite.scm +++ b/guix-build-coordinator/datastore/sqlite.scm @@ -2024,14 +2024,14 @@ WHERE agent_id = :agent_id" (metrics-registry-fetch-metric (slot-ref datastore 'metrics-registry) "build_allocation_plan_total"))) - (metric-set allocation-plan-metric - (or (assoc-ref - (datastore-count-build-allocation-plan-entries - datastore) - agent-id) - 0) - #:label-values - `((agent_id . ,agent-id))))) + (for-each + (match-lambda + ((agent-id . count) + (metric-set allocation-plan-metric + count + #:label-values + `((agent_id . ,agent-id))))) + (datastore-count-build-allocation-plan-entries datastore)))) ;; Previously allocate builds just returned newly allocated ;; builds, but if max-builds is provided, return all the |