2
0
mirror of https://github.com/frappe/bench.git synced 2024-09-29 23:39:02 +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:
Aradhya 2022-03-28 21:02:38 +05:30
parent 4441528d3f
commit bd105a6609
2 changed files with 6 additions and 0 deletions

View File

@ -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

View File

@ -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