diff options
author | Simon Westphahl <simon.westphahl@bmw.de> | 2021-08-30 15:32:57 +0200 |
---|---|---|
committer | Simon Westphahl <simon.westphahl@bmw.de> | 2021-09-16 10:50:29 +0200 |
commit | 0d635181f8d693c57b59d5144b997c0c8fe715ed (patch) | |
tree | 0ccc6fd7c2c93b2b19aa9cadfd75828917471f96 /zuul/driver/git | |
parent | 3971473c7c47dd8493987aec27ffe97055cb877e (diff) | |
download | zuul-0d635181f8d693c57b59d5144b997c0c8fe715ed.tar.gz |
Periodically maintain connection caches
With the persistent change cache in Zookeeper we need to periodically
remove changes that are outdated and no longer required by any active
item in the pipelines.
The cache maintenance will be performed together with the other general
cleanup every hour.
Change-Id: I62e75ab8c5b43f830e01b0e4c08b25ecdc5eed08
Diffstat (limited to 'zuul/driver/git')
-rw-r--r-- | zuul/driver/git/gitconnection.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/zuul/driver/git/gitconnection.py b/zuul/driver/git/gitconnection.py index 36b7242cd..61796a50b 100644 --- a/zuul/driver/git/gitconnection.py +++ b/zuul/driver/git/gitconnection.py @@ -103,11 +103,8 @@ class GitConnection(BaseConnection): refs[ref] = sha return refs - def maintainCache(self, relevant): - for change in self._change_cache: - if change not in relevant: - self._change_cache.delete(change.cache_stat.key) - # TODO: remove entries older than X + def maintainCache(self, relevant, max_age): + self._change_cache.prune(relevant, max_age) self._change_cache.cleanup() def getChange(self, event, refresh=False): |