Improve select-builds-with-context
Support specifying the limit, and improve the ordering.
This commit is contained in:
parent
092f01b6f2
commit
69d3c83986
1 changed files with 8 additions and 3 deletions
|
|
@ -119,7 +119,8 @@ ORDER BY status"))
|
||||||
|
|
||||||
(define* (select-builds-with-context conn build-statuses build-server-ids
|
(define* (select-builds-with-context conn build-statuses build-server-ids
|
||||||
#:key revision-commit
|
#:key revision-commit
|
||||||
system target)
|
system target
|
||||||
|
limit)
|
||||||
(define where-conditions
|
(define where-conditions
|
||||||
(filter
|
(filter
|
||||||
string?
|
string?
|
||||||
|
|
@ -180,8 +181,12 @@ ON latest_build_status.build_id = builds.id
|
||||||
"WHERE "
|
"WHERE "
|
||||||
(string-join where-conditions " AND ")))
|
(string-join where-conditions " AND ")))
|
||||||
"
|
"
|
||||||
ORDER BY latest_build_status.timestamp DESC
|
ORDER BY latest_build_status.timestamp DESC NULLS LAST, derivations.file_name
|
||||||
LIMIT 100"))
|
"
|
||||||
|
(if limit
|
||||||
|
(string-append
|
||||||
|
"LIMIT " (number->string limit))
|
||||||
|
"")))
|
||||||
|
|
||||||
(exec-query-with-null-handling conn
|
(exec-query-with-null-handling conn
|
||||||
query
|
query
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue