Stop removing changes from the cache

The zuul trigger ends up querying a large number of changes on
each merge, most of which are not in any pipelines.  To avoid
needlessly querying gerrit for data that do not change, keep
all changes that Zuul ever sees in the cache.

We could consider removing changes that are both not in pipelines
and closed (ie, keep all open changes), but we still end up querying
a number of merged changes each time due to Zuul following
dependencies of open changes.

Change-Id: Ie78df9aa43ec5ac35bdea79dcdafdfdd41d51d5b
This commit is contained in:
James E. Blair 2014-08-15 15:40:14 -07:00
parent f8ff9937b5
commit e2259ea455
2 changed files with 3 additions and 10 deletions

View File

@ -946,9 +946,6 @@ class ZuulTestCase(testtools.TestCase):
self.config.read(os.path.join(FIXTURE_DIR, "zuul.conf"))
def assertFinalState(self):
# Make sure that the change cache is cleared
self.assertEqual(len(self.gerrit._change_cache.keys()), 0,
"Change cache should have been cleared")
# Make sure that git.Repo objects have been garbage collected.
repos = []
gc.collect()

View File

@ -279,13 +279,9 @@ class Gerrit(object):
def maintainCache(self, relevant):
# This lets the user supply a list of change objects that are
# still in use. Anything in our cache that isn't in the supplied
# list should be same to remove from the cache.
remove = []
for key, change in self._change_cache.items():
if change not in relevant:
remove.append(key)
for key in remove:
del self._change_cache[key]
# list should be safe to remove from the cache.
# TODO(jeblair): consider removing this feature
return
def postConfig(self):
pass