1
mirror of https://github.com/comfyanonymous/ComfyUI.git synced 2025-08-02 23:14:49 +08:00

Fix some potential issues related to threads.

This commit is contained in:
comfyanonymous
2023-02-25 18:36:29 -05:00
parent 8074a58a1a
commit 6de6246dd4
2 changed files with 26 additions and 14 deletions

12
main.py
View File

@@ -371,6 +371,18 @@ class PromptQueue:
return True
return False
def get_history(self):
with self.mutex:
return copy.deepcopy(self.history)
def wipe_history(self):
with self.mutex:
self.history = {}
def delete_history_item(self, id_to_delete):
with self.mutex:
self.history.pop(id_to_delete, None)
async def run(server, address='', port=8188):
await asyncio.gather(server.start(address, port), server.publish_loop())