Browse Source

Fix file cache save bug

Jonas Borgström 11 years ago
parent
commit
df85e72d3c
1 changed files with 4 additions and 3 deletions
  1. 4 3
      attic/cache.py

+ 4 - 3
attic/cache.py

@@ -103,11 +103,12 @@ class Cache(object):
             return
         if self.files is not None:
             with open(os.path.join(self.path, 'files'), 'wb') as fd:
-                for item in self.files.items():
+                for path_hash, item in self.files.items():
                     # Discard cached files with the newest mtime to avoid
                     # issues with filesystem snapshots and mtime precision
-                    if item[1][0] < 10 and item[1][3] < self._newest_mtime:
-                        msgpack.pack(item, fd)
+                    item = msgpack.unpackb(item)
+                    if item[0] < 10 and bigint_to_int(item[3]) < self._newest_mtime:
+                        msgpack.pack((path_hash, item), fd)
         self.config.set('cache', 'manifest', hexlify(self.manifest.id).decode('ascii'))
         self.config.set('cache', 'timestamp', self.manifest.timestamp)
         with open(os.path.join(self.path, 'config'), 'w') as fd: