From 5de053520ef2a24b5ce0ff092685c1346fc83ce3 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 4 Jun 2008 20:41:35 +0000 Subject: Use sets for more accurate cache modification counts in BlockerCache and vardbapi. (trunk r10578) svn path=/main/branches/2.1.2/; revision=10579 --- bin/emerge | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'bin/emerge') diff --git a/bin/emerge b/bin/emerge index 12743c9d1..199a7b618 100755 --- a/bin/emerge +++ b/bin/emerge @@ -1605,7 +1605,7 @@ class BlockerCache(DictMixin): portage.CACHE_PATH.lstrip(os.path.sep), "vdb_blockers.pickle") self._cache_version = "1" self._cache_data = None - self._modified = 0 + self._modified = set() self._load() def _load(self): @@ -1674,7 +1674,7 @@ class BlockerCache(DictMixin): self._cache_data = {"version":self._cache_version} self._cache_data["blockers"] = {} self._cache_data["virtuals"] = self._virtuals - self._modified = 0 + self._modified.clear() def flush(self): """If the current user has permission and the internal blocker cache @@ -1692,7 +1692,7 @@ class BlockerCache(DictMixin): "virtuals" : vardb.settings.getvirtuals() } """ - if self._modified >= self._cache_threshold and \ + if len(self._modified) >= self._cache_threshold and \ secpass >= 2: try: f = portage_util.atomic_ofstream(self._cache_filename) @@ -1702,7 +1702,7 @@ class BlockerCache(DictMixin): self._cache_filename, gid=portage.portage_gid, mode=0644) except (IOError, OSError), e: pass - self._modified = 0 + self._modified.clear() def __setitem__(self, cpv, blocker_data): """ @@ -1716,7 +1716,7 @@ class BlockerCache(DictMixin): """ self._cache_data["blockers"][cpv] = \ (blocker_data.counter, tuple(str(x) for x in blocker_data.atoms)) - self._modified += 1 + self._modified.add(cpv) def __iter__(self): return iter(self._cache_data["blockers"]) -- cgit v1.2.3-1-g7c22