Skip to content

Commit

Permalink
fix(worker): only apply processor cancel logic if cancel event is for…
Browse files Browse the repository at this point in the history
… current queue item
  • Loading branch information
Mary Hipp authored and psychedelicious committed Dec 2, 2024
1 parent f8c7add commit a6be26e
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,9 @@ async def _on_batch_enqueued(self, event: FastAPIEvent[BatchEnqueuedEvent]) -> N
self._poll_now()

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

0 comments on commit a6be26e

Please sign in to comment.