mirror of
https://github.com/frappe/bench.git
synced 2025-01-10 09:02:10 +00:00
perf: caching deps and orgs, repos to avoid time taking checks & added slower version to check org and repo
This commit is contained in:
parent
4441528d3f
commit
bd105a6609
@ -8,6 +8,7 @@ import sys
|
||||
from glob import glob
|
||||
from shlex import split
|
||||
from typing import List, Tuple
|
||||
from functools import lru_cache
|
||||
|
||||
# imports - third party imports
|
||||
import click
|
||||
@ -421,6 +422,7 @@ def clear_command_cache(bench_path="."):
|
||||
print("Bench command cache doesn't exist in this folder!")
|
||||
|
||||
|
||||
@lru_cache(maxsize=5)
|
||||
def find_org(org_repo):
|
||||
import requests
|
||||
|
||||
@ -428,6 +430,8 @@ def find_org(org_repo):
|
||||
|
||||
for org in ["frappe", "erpnext"]:
|
||||
res = requests.head(f"https://api.github.com/repos/{org}/{org_repo}")
|
||||
if "message" in res.json():
|
||||
res = requests.head(f"https://github.com/{org}/{org_repo}")
|
||||
if res.ok:
|
||||
return org, org_repo
|
||||
|
||||
|
@ -10,6 +10,7 @@ from bench.exceptions import (
|
||||
VersionNotFound,
|
||||
)
|
||||
from bench.app import get_repo_dir
|
||||
from functools import lru_cache
|
||||
|
||||
|
||||
def is_version_upgrade(app="frappe", bench_path=".", branch=None):
|
||||
@ -168,6 +169,7 @@ def get_current_branch(app, bench_path="."):
|
||||
return get_cmd_output("basename $(git symbolic-ref -q HEAD)", cwd=repo_dir)
|
||||
|
||||
|
||||
@lru_cache(maxsize=5)
|
||||
def get_required_deps(org, name, branch, deps="hooks.py"):
|
||||
import requests
|
||||
import base64
|
||||
|
Loading…
Reference in New Issue
Block a user