Skip to content

Commit e83478e

Browse files
Merge pull request #691 from codeflash-ai/codeflash/optimize-pr690-2025-08-27T15.58.44
⚡️ Speed up function `get_patches_metadata` by 45% in PR #690 (`worktree/persist-optimization-patches`)
2 parents 0de7ebd + c35705e commit e83478e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

codeflash/code_utils/git_worktree_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@ def remove_worktree(worktree_dir: Path) -> None:
9494
logger.exception(f"Failed to remove worktree: {worktree_dir}")
9595

9696

97+
@lru_cache(maxsize=1)
9798
def get_patches_dir_for_project() -> Path:
98-
project_id = get_git_project_id()
99-
return patches_dir / project_id
99+
project_id = get_git_project_id() or ""
100+
return Path(patches_dir / project_id)
100101

101102

102103
def get_patches_metadata() -> dict[str, Any]:

0 commit comments

Comments
 (0)