|
21 | 21 | ) |
22 | 22 |
|
23 | 23 | from ..background_task import create_periodic_task |
24 | | -from ..logging_utils import log_catch |
25 | 24 | from ..redis import RedisClientSDK, exclusive |
26 | 25 | from ._redis_store import RedisStore |
27 | 26 | from ._serialization import object_to_string, string_to_object |
@@ -203,11 +202,11 @@ async def teardown(self) -> None: |
203 | 202 | # since the task is using a redis lock if the lock could not be acquired |
204 | 203 | # trying to cancel the task will hang, this avoids hanging |
205 | 204 | # there are no sideeffects in timing out this cancellation |
206 | | - with log_catch(_logger, reraise=False): |
207 | | - await cancel_wait_task( |
208 | | - self._task_stale_tasks_monitor, |
209 | | - max_delay=_MAX_EXCLUSIVE_TASK_CANCEL_TIMEOUT, |
210 | | - ) |
| 205 | + # with log_catch(_logger, reraise=False): |
| 206 | + await cancel_wait_task( |
| 207 | + self._task_stale_tasks_monitor, |
| 208 | + max_delay=_MAX_EXCLUSIVE_TASK_CANCEL_TIMEOUT, |
| 209 | + ) |
211 | 210 |
|
212 | 211 | # cancelled_tasks_removal |
213 | 212 | if self._task_cancelled_tasks_removal: |
@@ -277,7 +276,7 @@ async def _cancelled_tasks_removal(self) -> None: |
277 | 276 |
|
278 | 277 | cancelled_tasks = await self._tasks_data.get_all_to_cancel() |
279 | 278 | for task_id in cancelled_tasks: |
280 | | - await self._cancel_and_remove_local_task(task_id) |
| 279 | + await self._attempt_cancel_and_remove_local_task(task_id) |
281 | 280 |
|
282 | 281 | async def _status_update(self) -> None: |
283 | 282 | """ |
@@ -391,8 +390,8 @@ async def get_task_result( |
391 | 390 |
|
392 | 391 | return string_to_object(tracked_task.result_field.result) |
393 | 392 |
|
394 | | - async def _cancel_and_remove_local_task(self, task_id: TaskId) -> None: |
395 | | - """cancels task and removes if from local tracker if this is the worke that started it""" |
| 393 | + async def _attempt_cancel_and_remove_local_task(self, task_id: TaskId) -> None: |
| 394 | + """if task is running in the local process, cancel it and remove it""" |
396 | 395 |
|
397 | 396 | task_to_cancel = self._created_tasks.pop(task_id, None) |
398 | 397 | if task_to_cancel is not None: |
|
0 commit comments