From b3ce8fb9fd6209ef7542c90daac7f1cc8a969b70 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 13 Sep 2024 23:24:47 -0400 Subject: [PATCH 1/2] Revert "Reduce repeated calls of get_immediate_node_signature for ancestors in cache (#4871)" This reverts commit f6b7194f64ab4b32018eea0da9d9d89a30b582aa. --- comfy_execution/caching.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/comfy_execution/caching.py b/comfy_execution/caching.py index f163bc989..62311ed7f 100644 --- a/comfy_execution/caching.py +++ b/comfy_execution/caching.py @@ -67,7 +67,6 @@ class CacheKeySetInputSignature(CacheKeySet): super().__init__(dynprompt, node_ids, is_changed_cache) self.dynprompt = dynprompt self.is_changed_cache = is_changed_cache - self.immediate_node_signature = {} self.add_keys(node_ids) def include_node_id_in_input(self) -> bool: @@ -95,8 +94,6 @@ class CacheKeySetInputSignature(CacheKeySet): if not dynprompt.has_node(node_id): # This node doesn't exist -- we can't cache it. return [float("NaN")] - if node_id in self.immediate_node_signature: # reduce repeated calls of ancestors - return self.immediate_node_signature[node_id] node = dynprompt.get_node(node_id) class_type = node["class_type"] class_def = nodes.NODE_CLASS_MAPPINGS[class_type] @@ -111,7 +108,6 @@ class CacheKeySetInputSignature(CacheKeySet): signature.append((key,("ANCESTOR", ancestor_index, ancestor_socket))) else: signature.append((key, inputs[key])) - self.immediate_node_signature[node_id] = signature return signature # This function returns a list of all ancestors of the given node. The order of the list is From 369a6dd2c499a02b42496bab6286e34e9350c740 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Sat, 14 Sep 2024 12:30:44 +0900 Subject: [PATCH 2/2] Remove empty spaces in user_manager.py (#4917) --- app/user_manager.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/user_manager.py b/app/user_manager.py index 42bc496d5..05e6805f7 100644 --- a/app/user_manager.py +++ b/app/user_manager.py @@ -7,7 +7,7 @@ import shutil from aiohttp import web from urllib import parse from comfy.cli_args import args -import folder_paths +import folder_paths from .app_settings import AppSettings default_user = "default" @@ -65,7 +65,7 @@ class UserManager(): # Check if filename is url encoded if "%" in file: file = parse.unquote(file) - + # prevent leaving /{type}/{user} path = os.path.abspath(os.path.join(user_root, file)) if os.path.commonpath((user_root, path)) != user_root: @@ -165,14 +165,14 @@ class UserManager(): file = request.match_info.get(param, None) if not file: return web.Response(status=400) - + path = self.get_request_user_filepath(request, file) if not path: return web.Response(status=403) - + if check_exists and not os.path.exists(path): return web.Response(status=404) - + return path @routes.get("/userdata/{file}") @@ -180,7 +180,7 @@ class UserManager(): path = get_user_data_path(request, check_exists=True) if not isinstance(path, str): return path - + return web.FileResponse(path) @routes.post("/userdata/{file}") @@ -188,7 +188,7 @@ class UserManager(): path = get_user_data_path(request) if not isinstance(path, str): return path - + overwrite = request.query["overwrite"] != "false" if not overwrite and os.path.exists(path): return web.Response(status=409) @@ -197,7 +197,7 @@ class UserManager(): with open(path, "wb") as f: f.write(body) - + resp = os.path.relpath(path, self.get_request_user_filepath(request, None)) return web.json_response(resp) @@ -208,7 +208,7 @@ class UserManager(): return path os.remove(path) - + return web.Response(status=204) @routes.post("/userdata/{file}/move/{dest}") @@ -216,17 +216,17 @@ class UserManager(): source = get_user_data_path(request, check_exists=True) if not isinstance(source, str): return source - + dest = get_user_data_path(request, check_exists=False, param="dest") if not isinstance(source, str): return dest - + overwrite = request.query["overwrite"] != "false" if not overwrite and os.path.exists(dest): return web.Response(status=409) print(f"moving '{source}' -> '{dest}'") shutil.move(source, dest) - + resp = os.path.relpath(dest, self.get_request_user_filepath(request, None)) return web.json_response(resp)