diff options
author | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2019-04-02 10:18:37 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-04-09 09:12:43 +0000 |
commit | 95565a6b899e5af9c668339b6fb319e6f25c52f2 (patch) | |
tree | ff1a6d9e6f8cf0de8ce06cb1d8aa91bc6e2ac15c /buildstream/_cas | |
parent | bb75626c4c61fb1128b2cb22cfc63561cf7cd006 (diff) | |
download | buildstream-95565a6b899e5af9c668339b6fb319e6f25c52f2.tar.gz |
{artifact,source,cas}cache: fix one-shot callbacksaevri/pass_funcs_not_generators
Remove the unintended side-effect of only being able to iterate the
ref_callbacks results once. This would mean that subsequent calls to
clean() were not honoring the required_refs correctly.
Update CasQuota.clean() to call the ref callbacks and iterate over
their results.
When registering ref callbacks; pass the methods, and not the generators
that they return.
Diffstat (limited to 'buildstream/_cas')
-rw-r--r-- | buildstream/_cas/cascache.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/buildstream/_cas/cascache.py b/buildstream/_cas/cascache.py index c739c7ee1..eae3ef04d 100644 --- a/buildstream/_cas/cascache.py +++ b/buildstream/_cas/cascache.py @@ -1383,7 +1383,11 @@ class CASQuota: # get required refs refs = self.cas.list_refs() - required_refs = set(itertools.chain.from_iterable(self._ref_callbacks)) + required_refs = set( + required + for callback in self._ref_callbacks + for required in callback() + ) # Start off with an announcement with as much info as possible volume_size, volume_avail = self._get_cache_volume_size() |