Expose ComfyUI run time on Enhance jobs as run_ms

Parse execution_start vs the end event from /history, store it when the
poller moves a job to ready/failed (never overwritten with null), and
return it as "run_ms" on every job endpoint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cameron CordesandClaude Opus 5.5 committed 2026-10-30 19:08:48 -04:00
1 parent c7d810b812
commit 47ab6b3c00
9 files changed
+106 -4

No files matched your search

+3 -1
View File
@@ -467,7 +467,8 @@ auth and stays LAN-only, so ImageApi relays previews too.
`/history/{id}`: in queue -> queued/running with `queue_position`; finished ->
`ready` (staged results in `pending`) or `failed` (ComfyUI's message); known to
neither -> **`expired`** (ComfyUI restarted and cleared its temp folder). An
unreachable ComfyUI for `unreachable_grace_secs` -> `unavailable`. A preview or
unreachable ComfyUI for `unreachable_grace_secs` -> `unavailable`. `run_ms` is the `execution_start` -> end-event gap from `/history`, stored when the poller
moves a job to `ready`/`failed` and never overwritten with null. A preview or
approve that finds the staged result gone also expires the job (HTTP 410).
- **Idle `/free`**: every 30 s, if the queue is empty, none of our jobs is active and
ComfyUI's newest `/history` entry has not changed for `idle_free_secs` (it includes
@@ -502,6 +503,7 @@ POST /enhance/jobs/{id}/discard -> job (hidden from the list; ComfyUI untou
job = {"id","status","queue_position"?,"error"?,"path","library_id","template",
"prompt"?,"reference_path"?,"created_at","updated_at",
"run_ms": <ms ComfyUI ran it, or null until finished / when ComfyUI gave no timings>,
"pending": [{"n","preview": "/enhance/jobs/{id}/preview/{n}","approved"}],
"saved": [{"n","path","library_id"}]}
```