# HG changeset patch
# User Drew DeVault <sir@cmpwn.com>
# Date 1721987994 -7200
# Fri Jul 26 11:59:54 2024 +0200
# Node ID 9c84d5d778473104fea861f36b6b16a316436fa1
# Parent d9fc0f61ffddf26171417868763212d46a9be0c9
API: improve precision of repository cursors
Otherwise we run into a problem when a lot of resources are created within the
same second-resolution Unix timestamp, such as when I just scripted a bunch of
repo creation to test pagination locally. Matches a similar approach taken for
git.sr.ht in ee7701a9.
diff -r d9fc0f61ffdd -r 9c84d5d77847 api/graph/model/repository.go
--- a/api/graph/model/repository.go Sat Mar 30 20:03:00 2024 +0000
+++ b/api/graph/model/repository.go Fri Jul 26 11:59:54 2024 +0200
@@ -122,7 +122,7 @@
if cur.Next != "" {
ts, _ := strconv.ParseInt(cur.Next, 10, 64)
- updated := time.Unix(ts, 0)
+ updated := time.UnixMicro(ts).UTC()
q = q.Where(database.WithAlias(r.alias, "updated")+"<= ?", updated)
}
q = q.