From 3007c1f10bd240ba5f5f69b8765c25a5d4a6e459 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Thu, 10 Dec 2020 23:20:50 +0000 Subject: 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. --- guix-build-coordinator/datastore/sqlite.scm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'guix-build-coordinator/datastore') 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 -- cgit v1.2.3