feat(archive-cache): re-calculate size better if we miss it in stats
This commit is contained in:
parent
4ce101104b
commit
f642c7aebf
1 changed files with 11 additions and 7 deletions
|
|
@ -331,21 +331,25 @@ class FanoutCache:
|
||||||
key_file_path = os.path.join(shard._directory, key_file)
|
key_file_path = os.path.join(shard._directory, key_file)
|
||||||
with open(key_file_path, 'rb') as f:
|
with open(key_file_path, 'rb') as f:
|
||||||
metadata = json.loads(f.read())
|
metadata = json.loads(f.read())
|
||||||
# in case we don't have size re-calc it...
|
|
||||||
if not metadata.get('size'):
|
size = metadata.get('size')
|
||||||
fn = metadata.get('full_path')
|
filename = metadata.get('filename')
|
||||||
size = os.stat(fn).st_size
|
full_path = metadata.get('full_path')
|
||||||
|
|
||||||
|
if not size:
|
||||||
|
# in case we don't have size re-calc it...
|
||||||
|
size = os.stat(full_path).st_size
|
||||||
|
|
||||||
data.append([
|
data.append([
|
||||||
cnt,
|
cnt,
|
||||||
key_file,
|
key_file,
|
||||||
key_file_path,
|
key_file_path,
|
||||||
metadata.get('filename'),
|
filename,
|
||||||
metadata.get('full_path'),
|
full_path,
|
||||||
metadata.get('store_time', 0),
|
metadata.get('store_time', 0),
|
||||||
metadata.get('access_time', 0),
|
metadata.get('access_time', 0),
|
||||||
metadata.get('access_count', 0),
|
metadata.get('access_count', 0),
|
||||||
metadata.get('size', size),
|
size,
|
||||||
])
|
])
|
||||||
cnt += 1
|
cnt += 1
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue