Skip to content

Commit

Permalink
Use tmp file as uds path
Browse files Browse the repository at this point in the history
Signed-off-by: junjie.jiangjjj <junjie.jiang@zilliz.com>
  • Loading branch information
junjiejiangjjj committed May 9, 2024
1 parent 639340d commit f88c98c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/src/milvus_lite/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# the License.

from typing import List, Optional
import tempfile
import os
import subprocess
import pathlib
Expand Down Expand Up @@ -48,10 +49,12 @@ def __init__(self, db_file: str, address: Optional[str] = None):
self._db_file = pathlib.Path(db_file).absolute()
if not re.match(r'^[a-zA-Z0-9.\-_]+$', self._db_file.name):
raise RuntimeError(f"Unsupport db name {self._db_file.name}, the name must match ^[a-zA-Z0-9.\-_]+$")
if len(self._db_file.name) > 36:
raise RuntimeError(f"Db name {self._db_file.name} is too long, should be less than 36")
self._work_dir = self._db_file.parent
self._address= address
self._p = None
self._uds_path = str(self._db_file.parent / f'.{self._db_file.name}.sock')
self._uds_path = f"{tempfile.mktemp()}_{self._db_file.name}.sock"
self._lock_path = str(self._db_file.parent / f'.{self._db_file.name}.lock')
self._lock_fd = None

Expand Down

0 comments on commit f88c98c

Please sign in to comment.