Skip to content

Commit cb5160a

Browse files
committed
fix(cli): only create lock file when doesn't exist
1 parent a803eba commit cb5160a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/vectorcode/cli_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,8 +632,9 @@ def get_lock(self, path: str | os.PathLike) -> AsyncFileLock:
632632
if os.path.isdir(path):
633633
lock_file = os.path.join(path, "vectorcode.lock")
634634
logger.info(f"Creating {lock_file} for locking.")
635-
with open(lock_file, mode="w") as fin:
636-
fin.write("")
635+
if not os.path.isfile(lock_file):
636+
with open(lock_file, mode="w") as fin:
637+
fin.write("")
637638
path = lock_file
638639
if self.__locks.get(path) is None:
639640
self.__locks[path] = AsyncFileLock(path) # pyright: ignore[reportArgumentType]

0 commit comments

Comments
 (0)