Skip to content

Commit

Permalink
ENH: Avoid trying to cancel question if it's already finished
Browse files Browse the repository at this point in the history
skipci
  • Loading branch information
cortadocodes committed Feb 6, 2025
1 parent ac1ba02 commit a108f0e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions octue/cloud/pub_sub/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,15 @@ def cancel(self, question_uuid, event_store_table_id, timeout=30):
if len(questions) > 1:
raise ValueError("Multiple questions found with same question UUID %r.", question_uuid)

question_finished = get_events(
table_id=event_store_table_id,
question_uuid=question_uuid,
kinds=["result", "exception"],
)

if question_finished:
raise ValueError("Question %r has already finished.", question_uuid)

question_attributes = questions[0]

self._emit_event(
Expand Down

0 comments on commit a108f0e

Please sign in to comment.