Fix /api/latestbuilds ordering.
Evaluations are added sequentially to database but builds are not always registered nor performed in order. This means that a build corresponding to an older evaluation can be returned first if it was completed last. Order by descending evaluation id to prevent it. * src/cuirass/database.scm (db-get-builds): Add "evaluation" order. * src/cuirass/http.scm (url-handler): Order latestbuilds by descending evaluation number.
This commit is contained in:
parent
e9e0943945
commit
158966dca0
|
@ -926,6 +926,7 @@ FILTERS is an assoc list whose possible keys are 'derivation | 'id | 'jobset |
|
|||
(lambda (inner)
|
||||
(match (assq 'order filters)
|
||||
(('order . 'build-id) "Builds.id ASC")
|
||||
(('order . 'evaluation) "Builds.evaluation DESC")
|
||||
(('order . 'finish-time) "stoptime DESC")
|
||||
(('order . 'finish-time+build-id)
|
||||
(if inner
|
||||
|
|
|
@ -490,12 +490,16 @@ Hydra format."
|
|||
((> limit 1000)
|
||||
(respond-json-with-error 500 "Maximum limit exceeded"))
|
||||
(else
|
||||
;; Limit results to builds that are "done".
|
||||
;; Limit results to builds that are "done". Order the builds by
|
||||
;; descending evaluation numbers. This ensures that the builds that
|
||||
;; were last registered are first returned even if they take more
|
||||
;; time to complete. Ordering by timestamp wouldn't work as
|
||||
;; evaluations are not always performed sequentially.
|
||||
(respond-json
|
||||
(object->json-string
|
||||
(handle-builds-request `((status . done)
|
||||
,@params
|
||||
(order . finish-time)))))))))
|
||||
(order . evaluation)))))))))
|
||||
(('GET "api" "queue")
|
||||
(let* ((params (request-parameters request))
|
||||
;; 'nr parameter is mandatory to limit query size.
|
||||
|
|
Loading…
Reference in New Issue