Skip to content

Commit c0e328a

Browse files
author
Andrei Neagu
committed
bumped timeout
1 parent 169f617 commit c0e328a

File tree

1 file changed

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

1 file changed

+8
-4
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from common_library.async_tools import cancel_wait_task
1111
from models_library.api_schemas_long_running_tasks.base import TaskProgress
12-
from pydantic import PositiveFloat
12+
from pydantic import NonNegativeFloat, PositiveFloat
1313
from settings_library.redis import RedisDatabase, RedisSettings
1414
from tenacity import (
1515
AsyncRetrying,
@@ -39,6 +39,9 @@
3939
_CANCEL_TASKS_CHECK_INTERVAL: Final[datetime.timedelta] = datetime.timedelta(seconds=5)
4040
_STATUS_UPDATE_CHECK_INTERNAL: Final[datetime.timedelta] = datetime.timedelta(seconds=1)
4141

42+
_TASK_REMOVAL_MAX_WAIT: Final[NonNegativeFloat] = 60
43+
_TASK_REMOVAL_WAIT_CHECK_INTERVAL: Final[NonNegativeFloat] = 0.1
44+
4245

4346
RegisteredTaskName: TypeAlias = str
4447
RedisNamespace: TypeAlias = str
@@ -405,10 +408,11 @@ async def remove_task(
405408

406409
await self._tasks_data.delete_task_data(task_id)
407410

408-
# wait for task to be completed
411+
# wait for task to be removed since it might not have been running
412+
# in this process
409413
async for attempt in AsyncRetrying(
410-
wait=wait_fixed(0.1),
411-
stop=stop_after_delay(10),
414+
wait=wait_fixed(_TASK_REMOVAL_WAIT_CHECK_INTERVAL),
415+
stop=stop_after_delay(_TASK_REMOVAL_MAX_WAIT),
412416
retry=retry_if_exception_type(TryAgain),
413417
):
414418
with attempt:

0 commit comments

Comments
 (0)