##// END OF EJS Templates
feat(archive-cache): re-calculate size better if we miss it in stats
super-admin -
r5425:9c658c9d default
parent child Browse files
Show More
@@ -331,21 +331,25 b' class FanoutCache:'
331 key_file_path = os.path.join(shard._directory, key_file)
331 key_file_path = os.path.join(shard._directory, key_file)
332 with open(key_file_path, 'rb') as f:
332 with open(key_file_path, 'rb') as f:
333 metadata = json.loads(f.read())
333 metadata = json.loads(f.read())
334
335 size = metadata.get('size')
336 filename = metadata.get('filename')
337 full_path = metadata.get('full_path')
338
339 if not size:
334 # in case we don't have size re-calc it...
340 # in case we don't have size re-calc it...
335 if not metadata.get('size'):
341 size = os.stat(full_path).st_size
336 fn = metadata.get('full_path')
337 size = os.stat(fn).st_size
338
342
339 data.append([
343 data.append([
340 cnt,
344 cnt,
341 key_file,
345 key_file,
342 key_file_path,
346 key_file_path,
343 metadata.get('filename'),
347 filename,
344 metadata.get('full_path'),
348 full_path,
345 metadata.get('store_time', 0),
349 metadata.get('store_time', 0),
346 metadata.get('access_time', 0),
350 metadata.get('access_time', 0),
347 metadata.get('access_count', 0),
351 metadata.get('access_count', 0),
348 metadata.get('size', size),
352 size,
349 ])
353 ])
350 cnt += 1
354 cnt += 1
351
355
General Comments 0
You need to be logged in to leave comments. Login now