summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorValerie R Young <spectranaut@riseup.net>2016-10-25 13:06:06 -0400
committerHolger Levsen <holger@layer-acht.org>2016-10-25 19:15:52 +0200
commit573b7786a828268d6eb2c26ceb74814a7041cf64 (patch)
tree60532fdad86aaeec7d97830b5ebca6050b219ec4
parentdf98a2d7da2a0690e479c5ef44b31e77dec971a7 (diff)
downloadjenkins.debian.net-573b7786a828268d6eb2c26ceb74814a7041cf64.tar.xz
reproducible debian: speed up _scheduler.py significantly
This fix has to important parts: (1) changing a list to set for fast looks ups, and (2) changing a slqalchemy RowProxy object to a tuple for fast comparisons. Signed-off-by: Holger Levsen <holger@layer-acht.org>
-rwxr-xr-xbin/reproducible_scheduler.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/bin/reproducible_scheduler.py b/bin/reproducible_scheduler.py
index b279e021..bb0659e5 100755
--- a/bin/reproducible_scheduler.py
+++ b/bin/reproducible_scheduler.py
@@ -239,7 +239,7 @@ def update_sources_db(suite, arch, sources):
# get the current packages in the database
query = "SELECT name, version, suite, architecture FROM sources " + \
"WHERE suite='{}' AND architecture='{}'".format(suite, arch)
- cur_pkgs = query_db(query)
+ cur_pkgs = set([(p.name, p.version, p.suite, p.architecture) for p in query_db(query)])
pkgs_to_add = []
updated_pkgs = []
different_pkgs = [x for x in new_pkgs if x not in cur_pkgs]