Commit 40faba9
authored
Optimize install_github_app
The major performance bottleneck is repeated API calls to `is_github_app_installed_on_repo`, especially in the retry loop within `install_github_app`. These calls are redundant because the `owner` and `repo` arguments remain unchanged during each installation session. Caching the results of these checks using an LRU cache avoids unnecessary network calls, thus greatly improving performance without altering the function's behavior.
**Optimizations Applied:**
- Applied `@lru_cache(maxsize=16)` to `is_github_app_installed_on_repo` in `codeflash/api/cfapi.py` to automatically cache API responses for each unique `(owner, repo, suppress_errors)` tuple.
- This guarantees that within a single process run during a session/install, repeated checks for the same (owner, repo) do not trigger additional, expensive HTTP requests.
- No unnecessary changes made elsewhere; the slowdown was isolated entirely to repeated remote calls.
**Performance Impact:**
This drastically reduces the number of network round-trips in `install_github_app`, especially when prompting the user multiple times for the same repository.
---1 parent 59debb3 commit 40faba9
1 file changed
+1
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
| 264 | + | |
264 | 265 | | |
265 | 266 | | |
266 | 267 | | |
| |||
0 commit comments