aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nar-herder/database.scm29
1 files changed, 15 insertions, 14 deletions
diff --git a/nar-herder/database.scm b/nar-herder/database.scm
index 521e7cc..186ef6c 100644
--- a/nar-herder/database.scm
+++ b/nar-herder/database.scm
@@ -898,26 +898,27 @@ SELECT id, contents FROM narinfos WHERE substr(store_path, 12, 32) = :hash"
(sqlite-prepare
db
"
-SELECT datetime, change, data FROM recent_changes WHERE datetime >= :datetime LIMIT :limit"
+SELECT datetime, change, data
+FROM recent_changes
+WHERE datetime >= :datetime
+ORDER BY datetime ASC
+LIMIT :limit"
#:cache? #t)))
(sqlite-bind-arguments
statement
#:datetime after-date
#:limit limit)
- (let loop ((row (sqlite-step statement))
- (result '()))
- (match row
- (#(datetime change data)
- (loop (sqlite-step statement)
- (cons `((datetime . ,datetime)
- (change . ,change)
- (data . ,data))
- result)))
- (#f
- (sqlite-reset statement)
-
- (reverse result))))))))
+ (let ((result
+ (sqlite-map
+ (match-lambda
+ (#(datetime change data)
+ `((datetime . ,datetime)
+ (change . ,change)
+ (data . ,data))))
+ statement)))
+ (sqlite-reset statement)
+ result)))))
(define (database-select-latest-recent-change-datetime database)
(call-with-worker-thread