Skip to content

Commit a6be26e

Browse files
Mary Hipppsychedelicious
authored andcommitted
fix(worker): only apply processor cancel logic if cancel event is for current queue item
1 parent f8c7add commit a6be26e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

invokeai/app/services/session_processor/session_processor_default.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,9 @@ async def _on_batch_enqueued(self, event: FastAPIEvent[BatchEnqueuedEvent]) -> N
378378
self._poll_now()
379379

380380
async def _on_queue_item_status_changed(self, event: FastAPIEvent[QueueItemStatusChangedEvent]) -> None:
381+
# Make sure the cancel event is for the currently processing queue item
382+
if self._queue_item and self._queue_item.item_id is not event[1].item_id:
383+
return
381384
if self._queue_item and event[1].status in ["completed", "failed", "canceled"]:
382385
# When the queue item is canceled via HTTP, the queue item status is set to `"canceled"` and this event is
383386
# emitted. We need to respond to this event and stop graph execution. This is done by setting the cancel

0 commit comments

Comments
 (0)