aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-07-03 20:32:45 +0100
committerChristopher Baines <mail@cbaines.net>2020-07-03 20:32:45 +0100
commit69d3c83986233daa7bab7beb382a79274f9fe7af (patch)
treeb6c3ef65645e396e1b5155775ceb38315c8debc5 /guix-data-service
parent092f01b6f250beeb802ec073d5bd230f44535bff (diff)
downloaddata-service-69d3c83986233daa7bab7beb382a79274f9fe7af.tar
data-service-69d3c83986233daa7bab7beb382a79274f9fe7af.tar.gz
Improve select-builds-with-context
Support specifying the limit, and improve the ordering.
Diffstat (limited to 'guix-data-service')
-rw-r--r--guix-data-service/model/build.scm11
1 files changed, 8 insertions, 3 deletions
diff --git a/guix-data-service/model/build.scm b/guix-data-service/model/build.scm
index ac1e870..23e94bd 100644
--- a/guix-data-service/model/build.scm
+++ b/guix-data-service/model/build.scm
@@ -119,7 +119,8 @@ ORDER BY status"))
(define* (select-builds-with-context conn build-statuses build-server-ids
#:key revision-commit
- system target)
+ system target
+ limit)
(define where-conditions
(filter
string?
@@ -180,8 +181,12 @@ ON latest_build_status.build_id = builds.id
"WHERE "
(string-join where-conditions " AND ")))
"
-ORDER BY latest_build_status.timestamp DESC
-LIMIT 100"))
+ORDER BY latest_build_status.timestamp DESC NULLS LAST, derivations.file_name
+"
+ (if limit
+ (string-append
+ "LIMIT " (number->string limit))
+ "")))
(exec-query-with-null-handling conn
query