From 11f08aa7033883916f20e4990ecf7447037bff00 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Tue, 21 Apr 2015 22:37:27 +0200 Subject: reproducible: common.py: speed up the import by initializing the udd connection inside get_bugs() (current unique user of udd) --- bin/reproducible_common.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py index 202ea40b..75907a40 100755 --- a/bin/reproducible_common.py +++ b/bin/reproducible_common.py @@ -429,6 +429,9 @@ def get_bugs(): ) """ # returns a list of tuples [(id, source, done)] + global conn_udd + if not conn_udd: + conn_udd = start_udd_connection() rows = query_udd(query) log.info("finding out which usertagged bugs have been closed or at least have patches") packages = {} @@ -489,6 +492,8 @@ def get_trailing_bug_icon(bug, bugs, package=None): return html # init the databases connections -conn_db = start_db_connection() # the local sqlite3 reproducible db -conn_udd = start_udd_connection() +conn_db = start_db_connection() # the local sqlite3 reproducible db +# get_bugs() is the only user of this, let it initialize the connection itself, +# during it's first call to speed up things when unneeded +conn_udd = None -- cgit v1.2.3-54-g00ecf