From d33a19a8a5945ddef5401c74b37797146b3d353a Mon Sep 17 00:00:00 2001 From: Cameron Dale Date: Sun, 24 Feb 2008 15:14:00 -0800 Subject: [PATCH] Also remove changed cache files during directory scan. --- apt_dht/CacheManager.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apt_dht/CacheManager.py b/apt_dht/CacheManager.py index ccd544b..02021dc 100644 --- a/apt_dht/CacheManager.py +++ b/apt_dht/CacheManager.py @@ -194,14 +194,19 @@ class CacheManager: return # If it's already properly in the DB, ignore it - if self.db.isUnchanged(file): + db_status = self.db.isUnchanged(file) + if db_status: log.msg('file is unchanged: %s' % file.path) reactor.callLater(0, self._scanDirectories, None, walker) return # Don't hash files in the cache that are not in the DB if self.scanning[0] == self.cache_dir: - log.msg('ignoring unknown cache file: %s' % file.path) + if db_status is None: + log.msg('ignoring unknown cache file: %s' % file.path) + else: + log.msg('removing changed cache file: %s' % file.path) + file.remove() reactor.callLater(0, self._scanDirectories, None, walker) return -- 2.39.2