diff options
-rw-r--r-- | nar-herder/server.scm | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/nar-herder/server.scm b/nar-herder/server.scm index 86e966a..b3c50b6 100644 --- a/nar-herder/server.scm +++ b/nar-herder/server.scm @@ -290,22 +290,6 @@ (string->symbol compression) #f))) - (when (or narinfo-file-for-compression - ;; Check for a common compression to avoid lots of - ;; metrics being generated if compression is random - compression-symbol) - (increment-request-metric - (string-append "nar/" - compression) - (if narinfo-file-for-compression "200" "404") - #:labels - (if narinfo-file-for-compression - (let ((system (assq-ref narinfo 'system))) - (if (string? system) - `((system . ,system)) - '())) - '()))) - (if narinfo-file-for-compression (begin (when maybe-trigger-creation-of-compressed-nars @@ -315,6 +299,16 @@ (assq-ref narinfo 'id))) #:parallel? #t)) + (increment-request-metric + (string-append "nar/" + compression) + "200" + #:labels + (let ((system (assq-ref narinfo 'system))) + (if (string? system) + `((system . ,system)) + '()))) + (values (build-response #:code 200 #:headers `((X-Accel-Redirect @@ -329,6 +323,23 @@ database hash compression)))) + + (when (or cached-narinfo-file + ;; Check for a common compression to avoid lots of + ;; metrics being generated if compression is random + compression-symbol) + (increment-request-metric + (string-append "nar/" + compression) + (if cached-narinfo-file "200" "404") + #:labels + (if cached-narinfo-file + (let ((system (assq-ref narinfo 'system))) + (if (string? system) + `((system . ,system)) + '())) + '()))) + (if cached-narinfo-file (values (build-response #:code 200 |