Skip to content

Commit ef3b687

Browse files
author
Andrei Neagu
committed
rephrased
1 parent 9e246d6 commit ef3b687

File tree

1 file changed

+8
-9
lines changed
  • packages/service-library/src/servicelib/long_running_tasks

1 file changed

+8
-9
lines changed

packages/service-library/src/servicelib/long_running_tasks/task.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
)
2222

2323
from ..background_task import create_periodic_task
24-
from ..logging_utils import log_catch
2524
from ..redis import RedisClientSDK, exclusive
2625
from ._redis_store import RedisStore
2726
from ._serialization import object_to_string, string_to_object
@@ -203,11 +202,11 @@ async def teardown(self) -> None:
203202
# since the task is using a redis lock if the lock could not be acquired
204203
# trying to cancel the task will hang, this avoids hanging
205204
# 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+
)
211210

212211
# cancelled_tasks_removal
213212
if self._task_cancelled_tasks_removal:
@@ -277,7 +276,7 @@ async def _cancelled_tasks_removal(self) -> None:
277276

278277
cancelled_tasks = await self._tasks_data.get_all_to_cancel()
279278
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)
281280

282281
async def _status_update(self) -> None:
283282
"""
@@ -391,8 +390,8 @@ async def get_task_result(
391390

392391
return string_to_object(tracked_task.result_field.result)
393392

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"""
396395

397396
task_to_cancel = self._created_tasks.pop(task_id, None)
398397
if task_to_cancel is not None:

0 commit comments

Comments
 (0)