Efficiently recycle partial valid vdb cache when possible. This reduces disk load...
authorZac Medico <zmedico@gentoo.org>
Tue, 10 Apr 2007 06:03:38 +0000 (06:03 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 10 Apr 2007 06:03:38 +0000 (06:03 -0000)
svn path=/main/trunk/; revision=6360

pym/portage/dbapi/vartree.py

index 2d1d7c126bfd3129d44f5b41bdd28765aee1f058..e4de9c88d7d988485a4f2f32151f013c64880415 100644 (file)
@@ -396,13 +396,16 @@ class vardbapi(dbapi):
                if pkg_data:
                        cache_mtime, metadata = pkg_data
                        cache_valid = cache_mtime == mydir_mtime
-                       if cache_valid and set(metadata) != self._aux_cache_keys:
+               if cache_valid:
+                       cache_incomplete = self._aux_cache_keys.difference(metadata)
+                       if cache_incomplete:
                                # Allow self._aux_cache_keys to change without a cache version
-                               # bump.
+                               # bump and efficiently recycle partial cache whenever possible.
                                cache_valid = False
-               if cache_valid:
+                               pull_me = cache_incomplete.union(wants)
+                       else:
+                               pull_me = set(wants).difference(self._aux_cache_keys)
                        mydata.update(metadata)
-                       pull_me = set(wants).difference(self._aux_cache_keys)
                else:
                        pull_me = self._aux_cache_keys.union(wants)
                if pull_me: