[HiCache] Keep the file backend temp file name within NAME_MAX (#38925)

This commit is contained in:
Shuwen Wang
2026-09-14 05:12:28 +00:00
committed by GitHub
parent 2f5cc8e33e
commit 0d95a9c1ff
@@ -533,10 +533,7 @@ class HiCacheFile(HiCacheStorage):
return False
reserved = True
tmp_path = (
f"{tensor_path}.tmp."
f"{os.getpid()}.{threading.get_ident()}.{uuid.uuid4().hex}"
)
tmp_path = os.path.join(self.file_path, f".{uuid.uuid4().hex}.tmp")
value.contiguous().view(dtype=torch.uint8).numpy().tofile(tmp_path)
os.replace(tmp_path, tensor_path)
self._evictor.commit(suffixed)