Skip to content
Snippets Groups Projects
Commit 6d438496 authored by Tristan Van Berkom's avatar Tristan Van Berkom
Browse files

_artifactcache/artifactcache.py: Write the cache_size file atomically

This is causing issues while the size file is being read and written
simultaneously.

The proper fix will be to read/add/save the file atomically and that
will require locking, but this fix is a good stop gap to existing crashes.
parent 82305517
No related branches found
No related tags found
1 merge request!763_artifactcache/artifactcache.py: Write the cache_size file atomically
Pipeline #29040378 passed
......@@ -571,7 +571,7 @@ class ArtifactCache():
def _write_cache_size(self, size):
assert isinstance(size, int)
size_file_path = os.path.join(self.context.artifactdir, CACHE_SIZE_FILE)
with open(size_file_path, "w") as f:
with utils.save_file_atomic(size_file_path, "w") as f:
f.write(str(size))
# _read_cache_size()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment