commit:     32483c9459bcfc4f7e3848b3c0e3dc6c1c41829d
Author:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
AuthorDate: Wed Dec  7 02:08:03 2016 +0000
Commit:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
CommitDate: Wed Dec  7 02:08:03 2016 +0000
URL:        https://gitweb.gentoo.org/proj/grumpy.git/commit/?id=32483c94

sync: Order package details syncing based on how old the last sync was

This way if we got stuck and re-run much later (or it has exceeded the buffer
time constant), we'll at least sync the oldest ones first, so we always end
up being less out of date with the oldest sync ts.

 backend/lib/sync.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/backend/lib/sync.py b/backend/lib/sync.py
index 567da2d..0250fba 100644
--- a/backend/lib/sync.py
+++ b/backend/lib/sync.py
@@ -154,7 +154,7 @@ def sync_versions():
     for maintainer in Maintainer.query.all():
         existing_maintainers[maintainer.email] = maintainer
 
-    for package in Package.query.filter(Package.last_sync_ts < ts).all():
+    for package in Package.query.filter(Package.last_sync_ts < 
ts).order_by(Package.last_sync_ts).all():
         cnt += 1
         data = http_session.get(pkg_url_base + "packages/" + package.full_name 
+ ".json")
         if not data:

Reply via email to