diff --git a/tiatoolbox/visualization/tileserver.py b/tiatoolbox/visualization/tileserver.py index acce7dff6..1587ec984 100644 --- a/tiatoolbox/visualization/tileserver.py +++ b/tiatoolbox/visualization/tileserver.py @@ -482,7 +482,7 @@ def load_annotations(self: TileServer) -> str: file_path, np.array(model_mpp) / np.array(self.slide_mpps[session_id]), ) - tmp_path = Path(tempfile.gettempdir()) / "temp.db" + tmp_path = Path(tempfile.gettempdir()) / f"temp_{session_id}.db" sq.dump(tmp_path) sq = SQLiteStore(tmp_path) self.pyramids[session_id]["overlay"] = AnnotationTileGenerator( @@ -536,7 +536,7 @@ def change_overlay(self: TileServer) -> str: sq = SQLiteStore(overlay_path, auto_commit=False) else: # make a temporary db for the new annotations - tmp_path = Path(tempfile.gettempdir()) / "temp.db" + tmp_path = Path(tempfile.gettempdir()) / f"temp_{session_id}.db" sq.dump(tmp_path) sq = SQLiteStore(tmp_path) @@ -621,7 +621,7 @@ def commit_db(self: TileServer) -> str: if isinstance(layer, AnnotationTileGenerator): if ( layer.store.path.suffix == ".db" - and layer.store.path.name != "temp.db" + and layer.store.path.name != f"temp_{session_id}.db" ): logger.info("%s*.db committed.", layer.store.path.stem) layer.store.commit()