Merge pull request #16390 from cloudhan:win-fix-cache-threading

PiperOrigin-RevId: 540123680
This commit is contained in:
jax authors 2023-06-13 17:42:42 -07:00
commit 4d512c95e2

View File

@ -48,8 +48,8 @@ class GFileCache(CacheInterface):
f.write(value)
f.flush()
os.fsync(f.fileno())
os.rename(tmp_path, path_to_new_file)
os.replace(tmp_path, path_to_new_file)
else:
tmp_path = self._path / f"_temp_{key}"
tmp_path.write_bytes(value)
tmp_path.rename(str(path_to_new_file))
tmp_path.replace(str(path_to_new_file))