diff --git a/ayon_server/helpers/inherited_attributes.py b/ayon_server/helpers/inherited_attributes.py index 484a27fe..ad709e77 100644 --- a/ayon_server/helpers/inherited_attributes.py +++ b/ayon_server/helpers/inherited_attributes.py @@ -33,17 +33,25 @@ async def _rebuild_in_transaction( """ ) + # path: attrib_set cache to use when returning from child to parent + caching: dict[tuple[str, ...], dict[str, Any]] = {} + current_attrib_set: dict[str, Any] = {} buff: list[tuple[str, str, dict[str, Any]]] = [] async for record in st_crawl.cursor(): - path_elements = record["path"].split("/") + path_elements = tuple(record["path"].split("/")) if len(path_elements) == 1: current_attrib_set = project_attrib.copy() + elif path_elements[:-1] in caching: + current_attrib_set = caching[path_elements[:-1]] + new_attrib_set = current_attrib_set.copy() new_attrib_set.update(record["own"]) + caching[path_elements] = new_attrib_set + if record["exported"] != new_attrib_set: buff.append( (