summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelos Evripiotis <jevripiotis@bloomberg.net>2019-03-13 15:55:21 +0000
committerbst-marge-bot <marge-bot@buildstream.build>2019-03-21 15:58:17 +0000
commitfcc35a8ce9f2c5cdadb7e5f486b8f14ab5a515c3 (patch)
treea657bd1ffda579ffc33c6c0018ede86e49c1aee2
parentf7a79ff0aee5b2a85cd1913b83056742aaa1f2ed (diff)
downloadbuildstream-fcc35a8ce9f2c5cdadb7e5f486b8f14ab5a515c3.tar.gz
cascache: rm redundant calculate_cache_size
It seems that `CASQuota.calculate_cache_size` had historical significance, but is now not necessary. Inline it into `CASQuota.compute_cache_size` to make things simpler. Also remove a redundant compare and assign.
-rw-r--r--buildstream/_cas/cascache.py20
1 files changed, 2 insertions, 18 deletions
diff --git a/buildstream/_cas/cascache.py b/buildstream/_cas/cascache.py
index aece69fd6..086510bf7 100644
--- a/buildstream/_cas/cascache.py
+++ b/buildstream/_cas/cascache.py
@@ -1064,31 +1064,15 @@ class CASQuota:
# compute_cache_size()
#
- # Computes the real artifact cache size by calling
- # the abstract calculate_cache_size() method.
+ # Computes the real artifact cache size.
#
# Returns:
# (int): The size of the artifact cache.
#
def compute_cache_size(self):
- old_cache_size = self._cache_size
- new_cache_size = self.calculate_cache_size()
-
- if old_cache_size != new_cache_size:
- self._cache_size = new_cache_size
-
+ self._cache_size = utils._get_dir_size(self.casdir)
return self._cache_size
- # calculate_cache_size()
- #
- # Return the real disk usage of the CAS cache.
- #
- # Returns:
- # (int): The size of the cache.
- #
- def calculate_cache_size(self):
- return utils._get_dir_size(self.casdir)
-
# get_cache_size()
#
# Fetches the cached size of the cache, this is sometimes