feat(disk-cache): use fsync to force flush changes on NFS, and use retry mechanism to archive caches...
This commit is contained in:
parent
164d313bea
commit
3d0e81968b
2 changed files with 8 additions and 1 deletions
|
|
@ -459,7 +459,7 @@ class RepoFilesView(RepoAppView):
|
|||
response.location = location
|
||||
return response
|
||||
|
||||
reader, metadata = d_cache.fetch(archive_name_key)
|
||||
reader, metadata = d_cache.fetch(archive_name_key, retry=True, retry_attempts=30)
|
||||
|
||||
response = Response(app_iter=archive_iterator(reader))
|
||||
response.content_disposition = f'attachment; filename={response_archive_name}'
|
||||
|
|
|
|||
|
|
@ -139,6 +139,13 @@ class FileSystemCache:
|
|||
for chunk in iterator:
|
||||
size += len(chunk)
|
||||
writer.write(chunk)
|
||||
writer.flush()
|
||||
# Get the file descriptor
|
||||
fd = writer.fileno()
|
||||
|
||||
# Sync the file descriptor to disk, helps with NFS cases...
|
||||
os.fsync(fd)
|
||||
log.debug('written new archive cache under %s', full_path)
|
||||
return size
|
||||
|
||||
def _get_keyfile(self, key):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue