mirror of
https://github.com/frappe/bench.git
synced 2024-11-13 16:56:33 +00:00
perf: Cache Bench and App instantiation
This commit is contained in:
parent
ac07d8dc52
commit
cd1f526d09
@ -1,4 +1,5 @@
|
||||
# imports - standard imports
|
||||
import functools
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
@ -7,6 +8,7 @@ import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import typing
|
||||
from datetime import date
|
||||
|
||||
# imports - third party imports
|
||||
import click
|
||||
@ -127,7 +129,7 @@ class AppMeta:
|
||||
def get_ssh_url(self):
|
||||
return f"git@{self.remote_server}:{self.org}/{self.repo}.git"
|
||||
|
||||
|
||||
@functools.lru_cache(maxsize=None)
|
||||
class App(AppMeta):
|
||||
def __init__(
|
||||
self, name: str, branch: str = None, bench: "Bench" = None, *args, **kwargs
|
||||
|
@ -1,3 +1,5 @@
|
||||
# imports - standard imports
|
||||
import functools
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
@ -45,6 +47,7 @@ class Validator:
|
||||
validate_app_installed_on_sites(app, bench_path=self.name)
|
||||
|
||||
|
||||
@functools.lru_cache(maxsize=None)
|
||||
class Bench(Base, Validator):
|
||||
def __init__(self, path):
|
||||
self.name = path
|
||||
|
@ -29,6 +29,7 @@ from bench.utils import (
|
||||
)
|
||||
from bench.utils.bench import get_env_cmd
|
||||
|
||||
fancy = True
|
||||
from_command_line = False
|
||||
bench.LOG_BUFFER = []
|
||||
change_uid_msg = "You should not run this command as root"
|
||||
|
Loading…
Reference in New Issue
Block a user