mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-21 20:00:17 +08:00
Fix polling for history too quickly. This will need an alternative approach so that readiness is immediate
This commit is contained in:
parent
d25394d386
commit
6ef2d534b6
@ -733,16 +733,18 @@ class PromptServer(ExecutorToClientProgress):
|
|||||||
return web.Response(status=404)
|
return web.Response(status=404)
|
||||||
|
|
||||||
history_items = self.prompt_queue.get_history(prompt_id)
|
history_items = self.prompt_queue.get_history(prompt_id)
|
||||||
if len(history_items) == 0:
|
if len(history_items) == 0 or prompt_id not in history_items:
|
||||||
# todo: this should really be moved to a stateful queue abstraction
|
# todo: this should really be moved to a stateful queue abstraction
|
||||||
if prompt_id in self.background_tasks:
|
if prompt_id in self.background_tasks:
|
||||||
return web.Response(status=204)
|
return web.Response(status=204)
|
||||||
else:
|
else:
|
||||||
# todo: this should check a stateful queue abstraction
|
# todo: this should check a stateful queue abstraction
|
||||||
return web.Response(status=404)
|
return web.Response(status=404)
|
||||||
else:
|
elif prompt_id in history_items:
|
||||||
history_entry = history_items[prompt_id]
|
history_entry = history_items[prompt_id]
|
||||||
return web.json_response(history_entry["outputs"])
|
return web.json_response(history_entry["outputs"])
|
||||||
|
else:
|
||||||
|
return web.Response(status=500)
|
||||||
|
|
||||||
@routes.post("/api/v1/prompts")
|
@routes.post("/api/v1/prompts")
|
||||||
async def post_api_prompt(request: web.Request) -> web.Response | web.FileResponse:
|
async def post_api_prompt(request: web.Request) -> web.Response | web.FileResponse:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user