Skip to content

Commit aef2266

Browse files
committed
fix: cancel function invocation when deadline exceeded
- for now, this will mainly work in cases when the task is still in the queue - once the task is running & making the function call, there is no mechanism to tell the call to cancel JIRA: CQ-1005
1 parent 3ec2ce4 commit aef2266

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

gooddata-flexconnect/gooddata_flexconnect/function/flight_methods.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ def get_flight_info(
150150
# XXX: this should be enhanced to implement polling
151151
task_result = self._ctx.task_executor.wait_for_result(task.task_id, self._call_deadline)
152152
except TaskWaitTimeoutError:
153+
cancelled = self._ctx.task_executor.cancel(task.task_id)
154+
_LOGGER.warning(
155+
"flexconnect_fun_call_timeout", task_id=task.task_id, fun=task.fun_name, cancelled=cancelled
156+
)
157+
153158
raise ErrorInfo.for_reason(
154159
ErrorCode.TIMEOUT, f"GetFlightInfo timed out while waiting for task {task.task_id}."
155160
).to_timeout_error()

0 commit comments

Comments
 (0)