mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
Re-use global settings more since the data is large and query is slow over network (2s+)
This commit is contained in:
parent
b088e952e6
commit
2373d13348
2 changed files with 8 additions and 8 deletions
|
|
@ -161,18 +161,17 @@ def get_openpype_global_settings(url: str) -> dict:
|
|||
return global_settings.get("data") or {}
|
||||
|
||||
|
||||
def get_openpype_path_from_db(url: str) -> Union[str, None]:
|
||||
def get_openpype_path_from_db(settings: dict) -> Union[str, None]:
|
||||
"""Get OpenPype path from global settings.
|
||||
|
||||
Args:
|
||||
url (str): mongodb url.
|
||||
settings (dict): mongodb url.
|
||||
|
||||
Returns:
|
||||
path to OpenPype or None if not found
|
||||
"""
|
||||
global_settings = get_openpype_global_settings(url)
|
||||
paths = (
|
||||
global_settings
|
||||
settings
|
||||
.get("openpype_path", {})
|
||||
.get(platform.system().lower())
|
||||
) or []
|
||||
|
|
|
|||
9
start.py
9
start.py
|
|
@ -281,12 +281,11 @@ def run(arguments: list, env: dict = None) -> int:
|
|||
return p.returncode
|
||||
|
||||
|
||||
def run_disk_mapping_commands(mongo_url):
|
||||
def run_disk_mapping_commands(settings):
|
||||
""" Run disk mapping command
|
||||
|
||||
Used to map shared disk for OP to pull codebase.
|
||||
"""
|
||||
settings = get_openpype_global_settings(mongo_url)
|
||||
|
||||
low_platform = platform.system().lower()
|
||||
disk_mapping = settings.get("disk_mapping")
|
||||
|
|
@ -923,12 +922,14 @@ def boot():
|
|||
os.environ["OPENPYPE_DATABASE_NAME"] = \
|
||||
os.environ.get("OPENPYPE_DATABASE_NAME") or "openpype"
|
||||
|
||||
global_settings = get_openpype_global_settings(openpype_mongo)
|
||||
|
||||
_print(">>> run disk mapping command ...")
|
||||
run_disk_mapping_commands(openpype_mongo)
|
||||
run_disk_mapping_commands(global_settings)
|
||||
|
||||
# Get openpype path from database and set it to environment so openpype can
|
||||
# find its versions there and bootstrap them.
|
||||
openpype_path = get_openpype_path_from_db(openpype_mongo)
|
||||
openpype_path = get_openpype_path_from_db(global_settings)
|
||||
|
||||
if getattr(sys, 'frozen', False):
|
||||
local_version = bootstrap.get_version(Path(OPENPYPE_ROOT))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue