counter_tick_core: flush the cache (periodically)
authorZac Medico <zmedico@gentoo.org>
Fri, 27 May 2011 02:14:20 +0000 (19:14 -0700)
committerZac Medico <zmedico@gentoo.org>
Fri, 27 May 2011 02:16:06 +0000 (19:16 -0700)
Since we hold a lock, this is a good opportunity to flush the cache.
Note that this will only flush the cache periodically in the main
process when _aux_cache_threshold is exceeded.

pym/portage/dbapi/vartree.py

index 0ff2f7d6fa73971798a858000c83441d5b9d1f18..f93652b370fccd82b9098720fb5f5328446bba17 100644 (file)
@@ -798,6 +798,12 @@ class vardbapi(dbapi):
                                        self.settings._init_dirs()
                                        write_atomic(self._counter_path, str(counter))
                        self._cached_counter = counter
+
+                       # Since we hold a lock, this is a good opportunity
+                       # to flush the cache. Note that this will only
+                       # flush the cache periodically in the main process
+                       # when _aux_cache_threshold is exceeded.
+                       self.flush_cache()
                finally:
                        self.unlock()