From: Cameron Dale Date: Sun, 24 Feb 2008 23:14:00 +0000 (-0800) Subject: Also remove changed cache files during directory scan. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d33a19a8a5945ddef5401c74b37797146b3d353a;p=quix0rs-apt-p2p.git Also remove changed cache files during directory scan. --- 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