mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2025-12-19 11:23:00 +08:00
refresh cache before reporting status
This commit is contained in:
parent
b55e1404b1
commit
b73dc6121f
@ -289,7 +289,7 @@ class TaskQueue:
|
|||||||
)
|
)
|
||||||
return item, task_index
|
return item, task_index
|
||||||
|
|
||||||
def task_done(
|
async def task_done(
|
||||||
self,
|
self,
|
||||||
item: QueueTaskItem,
|
item: QueueTaskItem,
|
||||||
task_index: int,
|
task_index: int,
|
||||||
@ -327,6 +327,16 @@ class TaskQueue:
|
|||||||
status=pydantic_status,
|
status=pydantic_status,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Force cache refresh for successful pack-modifying operations
|
||||||
|
pack_modifying_tasks = {"install", "uninstall", "enable", "disable"}
|
||||||
|
if (item.kind in pack_modifying_tasks and
|
||||||
|
status and status.status_str == "success"):
|
||||||
|
try:
|
||||||
|
# Force unified_manager to refresh its installed packages cache
|
||||||
|
await core.unified_manager.reload("cache", dont_wait=True, update_cnr_map=False)
|
||||||
|
except Exception as e:
|
||||||
|
logging.warning(f"[ComfyUI-Manager] Failed to refresh cache after {item.kind}: {e}")
|
||||||
|
|
||||||
# Send WebSocket message indicating task is complete
|
# Send WebSocket message indicating task is complete
|
||||||
TaskQueue.send_queue_state_update(
|
TaskQueue.send_queue_state_update(
|
||||||
ManagerMessageName.cm_task_completed.value,
|
ManagerMessageName.cm_task_completed.value,
|
||||||
@ -858,7 +868,7 @@ async def task_worker():
|
|||||||
msg = "Unexpected kind: " + kind
|
msg = "Unexpected kind: " + kind
|
||||||
except Exception:
|
except Exception:
|
||||||
msg = f"Exception: {(kind, item)}"
|
msg = f"Exception: {(kind, item)}"
|
||||||
task_queue.task_done(
|
await task_queue.task_done(
|
||||||
item, task_index, msg, TaskQueue.ExecutionStatus("error", True, [msg])
|
item, task_index, msg, TaskQueue.ExecutionStatus("error", True, [msg])
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
@ -877,7 +887,7 @@ async def task_worker():
|
|||||||
else:
|
else:
|
||||||
status = TaskQueue.ExecutionStatus("error", True, [result_msg])
|
status = TaskQueue.ExecutionStatus("error", True, [result_msg])
|
||||||
|
|
||||||
task_queue.task_done(item, task_index, result_msg, status)
|
await task_queue.task_done(item, task_index, result_msg, status)
|
||||||
|
|
||||||
|
|
||||||
@routes.post("/v2/manager/queue/task")
|
@routes.post("/v2/manager/queue/task")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user