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)
|
||||
with open(key_file_path, 'rb') as f:
|
||||
metadata = json.loads(f.read())
|
||||
# in case we don't have size re-calc it...
|
||||
if not metadata.get('size'):
|
||||
fn = metadata.get('full_path')
|
||||
size = os.stat(fn).st_size
|
||||
|
||||
size = metadata.get('size')
|
||||
filename = metadata.get('filename')
|
||||
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([
|
||||
cnt,
|
||||
key_file,
|
||||
key_file_path,
|
||||
metadata.get('filename'),
|
||||
metadata.get('full_path'),
|
||||
filename,
|
||||
full_path,
|
||||
metadata.get('store_time', 0),
|
||||
metadata.get('access_time', 0),
|
||||
metadata.get('access_count', 0),
|
||||
metadata.get('size', size),
|
||||
size,
|
||||
])
|
||||
cnt += 1
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue