| |
@@ -112,7 +112,8 @@
|
| |
|
| |
class BugzillaProxy:
|
| |
|
| |
- def __init__(self, bz_server, username, password, config):
|
| |
+ def __init__(self, bz_server, username, password, config,
|
| |
+ pre_cache_users=True):
|
| |
self.bz_xmlrpc_server = bz_server
|
| |
self.username = username
|
| |
self.password = password
|
| |
@@ -123,6 +124,7 @@
|
| |
password=self.password)
|
| |
|
| |
self.product_cache = {}
|
| |
+ self.user_cache = {}
|
| |
self.inverted_user_cache = {}
|
| |
|
| |
# Connect to the fedora account system
|
| |
@@ -133,6 +135,12 @@
|
| |
|
| |
self.config = config
|
| |
|
| |
+ if not pre_cache_users:
|
| |
+ return
|
| |
+
|
| |
+ if config['verbose']:
|
| |
+ print("Pre-caching FAS users and their Bugzilla email addresses.")
|
| |
+
|
| |
try:
|
| |
self.user_cache = self.fas.people_by_key(
|
| |
key='username',
|
| |
@@ -140,7 +148,9 @@
|
| |
except fedora.client.ServerError:
|
| |
# Sometimes, building the user cache up front fails with a timeout.
|
| |
# It's ok, we build the cache as-needed later in the script.
|
| |
- self.user_cache = {}
|
| |
+ pass
|
| |
+ else:
|
| |
+ self.invert_user_cache()
|
| |
|
| |
def build_product_cache(self, pagure_projects):
|
| |
""" Cache the bugzilla info about each package in each product.
|
| |
@@ -741,15 +751,15 @@
|
| |
times["data structure end"] = time.time()
|
| |
delta = times["data structure end"] - times["start"]
|
| |
print("Ran for %s seconds -- ie: %.2f minutes" % (delta, delta/60.0))
|
| |
- print("Building FAS' cache")
|
| |
|
| |
# Initialize the connection to bugzilla
|
| |
- bugzilla = BugzillaProxy(self.env['bugzilla']['url'],
|
| |
- self.env['bugzilla']['user'],
|
| |
- self.env['bugzilla']['password'],
|
| |
- self.env)
|
| |
- if self.args.print_fas_names:
|
| |
- bugzilla.invert_user_cache()
|
| |
+ bugzilla = BugzillaProxy(
|
| |
+ bz_server=self.env['bugzilla']['url'],
|
| |
+ username=self.env['bugzilla']['user'],
|
| |
+ password=self.env['bugzilla']['password'],
|
| |
+ config=self.env,
|
| |
+ pre_cache_users=not self.args.projects or self.args.print_fas_names,
|
| |
+ )
|
| |
|
| |
if self.env["verbose"]:
|
| |
times["FAS cache building end"] = time.time()
|
| |
If the user specifies individual projects and doesn't need to map email addresses back to users, caching user <-> BZ email addresses is too much of an overhead.