add tid to cache name to avoid non-safe uuid4 on windows

This commit is contained in:
Lincoln Stein 2024-04-16 15:02:06 -04:00
parent a84f3058e2
commit bd833900a3

View File

@ -1,3 +1,4 @@
import threading
import tempfile
import typing
from dataclasses import dataclass
@ -70,7 +71,8 @@ class ObjectSerializerDisk(ObjectSerializerBase[T]):
return self._output_dir / name
def _new_name(self) -> str:
return f"{self._obj_class_name}_{uuid_string()}"
tid = threading.current_thread().ident
return f"{self._obj_class_name}_{tid}_{uuid_string()}"
def _tempdir_cleanup(self) -> None:
"""Calls `cleanup` on the temporary directory, if it exists."""