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
diff --git a/tests/base.py b/tests/base.py
index 5f15297..179f4f4 100755
--- a/tests/base.py
+++ b/tests/base.py
@@ -946,9 +946,6 @@
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()
diff --git a/zuul/trigger/gerrit.py b/zuul/trigger/gerrit.py
index d05fc69..754c942 100644
--- a/zuul/trigger/gerrit.py
+++ b/zuul/trigger/gerrit.py
@@ -279,13 +279,9 @@
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