Skip to content

Commit a94898b

Browse files
committed
fix: test for cancellation before task returns result
- see code comments for explanation JIRA: CQ-1005
1 parent 84db8bf commit a94898b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

gooddata-flexconnect/gooddata_flexconnect/function/function_task.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ def run(self) -> Union[TaskResult, TaskError]:
4545
headers=self._headers,
4646
)
4747

48+
# switch task to non-cancellable state; once the code creates
49+
# and returns the result, the task successfully executed and there
50+
# is nothing to cancel.
51+
#
52+
# NOTE: if the switch finds that task got cancelled already, it
53+
# bails and raises error.
54+
self.switch_non_cancellable()
55+
4856
return FlightDataTaskResult.for_data(result)
4957

5058
def on_task_cancel(self) -> None:

0 commit comments

Comments
 (0)