Refresh the packages in multiple threads

This commit is contained in:
Stephan Kulow
2022-11-03 22:04:45 +01:00
parent ab38332642
commit d21ce571f5
3 changed files with 115 additions and 73 deletions

View File

@@ -111,13 +111,18 @@ class DBRevision:
return DBRevision(db, row)
@staticmethod
def latest_revision(db, project, package):
def max_rev(db, project, package):
with db.cursor() as cur:
cur.execute(
"SELECT MAX(rev) FROM revisions where project=%s and package=%s",
(project, package),
)
max = cur.fetchone()[0]
return cur.fetchone()[0]
return None
@staticmethod
def latest_revision(db, project, package):
max = DBRevision.max_rev(db, project, package)
if max:
return DBRevision.fetch_revision(db, project, package, max)
return None