mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-23 05:56:59 +08:00
fix #3192
This commit is contained in:
parent
517650558a
commit
5a0da3439d
@ -115,6 +115,7 @@ class PromptServer():
|
|||||||
logging.warning('ws connection closed with exception %s' % ws.exception())
|
logging.warning('ws connection closed with exception %s' % ws.exception())
|
||||||
finally:
|
finally:
|
||||||
self.sockets.pop(sid, None)
|
self.sockets.pop(sid, None)
|
||||||
|
self.cleanup_if_idle()
|
||||||
return ws
|
return ws
|
||||||
|
|
||||||
@routes.get("/")
|
@routes.get("/")
|
||||||
@ -614,6 +615,7 @@ class PromptServer():
|
|||||||
|
|
||||||
def queue_updated(self):
|
def queue_updated(self):
|
||||||
self.send_sync("status", { "status": self.get_queue_info() })
|
self.send_sync("status", { "status": self.get_queue_info() })
|
||||||
|
self.cleanup_if_idle()
|
||||||
|
|
||||||
async def publish_loop(self):
|
async def publish_loop(self):
|
||||||
while True:
|
while True:
|
||||||
@ -644,3 +646,9 @@ class PromptServer():
|
|||||||
logging.warning(traceback.format_exc())
|
logging.warning(traceback.format_exc())
|
||||||
|
|
||||||
return json_data
|
return json_data
|
||||||
|
|
||||||
|
def cleanup_if_idle(self):
|
||||||
|
if len(self.sockets) == 0:
|
||||||
|
with self.prompt_queue.mutex:
|
||||||
|
if len(self.prompt_queue.currently_running) == 0 and len(self.prompt_queue.queue) == 0:
|
||||||
|
comfy.model_management.unload_all_models()
|
||||||
Loading…
x
Reference in New Issue
Block a user