File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed
packages/service-library/src/servicelib/long_running_tasks Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change 2323_logger = logging .getLogger (__name__ )
2424
2525_RPC_MAX_CANCELLATION_TIMEOUT : Final [PositiveInt ] = int (
26- timedelta (minutes = 60 ).total_seconds ()
26+ timedelta (hours = 1 ).total_seconds ()
2727)
2828_RPC_TIMEOUT_SHORT_REQUESTS : Final [PositiveInt ] = int (
2929 timedelta (seconds = 20 ).total_seconds ()
@@ -137,9 +137,9 @@ async def remove_task(
137137 * ,
138138 task_context : TaskContext ,
139139 task_id : TaskId ,
140- wait_for_removal : bool ,
141140 reraise_errors : bool ,
142- cancellation_timeout : timedelta | None = None ,
141+ wait_for_removal : bool ,
142+ cancellation_timeout : timedelta | None ,
143143) -> None :
144144 timeout_s = (
145145 _RPC_MAX_CANCELLATION_TIMEOUT
Original file line number Diff line number Diff line change 1+ from datetime import timedelta
12from typing import Any
23
34from ..rabbitmq ._client_rpc import RabbitMQRPCClient
@@ -104,13 +105,27 @@ async def remove_task(
104105 task_id : TaskId ,
105106 * ,
106107 wait_for_removal : bool ,
108+ cancellation_timeout : timedelta | None = None ,
107109) -> None :
108- """cancels and removes the task"""
110+ """cancels and removes a task
111+
112+ Arguments:
113+ wait_for_removal -- if True, then it will wait for the task to be removed
114+ before returning otherwise returns immediately
115+
116+ Keyword Arguments:
117+ cancellation_timeout (default: {None}) -- if specified it's the amount of
118+ time to wait before cancellation is timedout
119+ if not specified and:
120+ - wait_for_removal is True, it's set to _RPC_TIMEOUT_SHORT_REQUESTS
121+ - wait_for_removal is False it's set to _RPC_MAX_CANCELLATION_TIMEOUT
122+ """
109123 await _lrt_client .remove_task (
110124 rabbitmq_rpc_client ,
111125 lrt_namespace ,
112126 task_id = task_id ,
113127 task_context = task_context ,
114- wait_for_removal = wait_for_removal ,
115128 reraise_errors = True ,
129+ wait_for_removal = wait_for_removal ,
130+ cancellation_timeout = cancellation_timeout ,
116131 )
You can’t perform that action at this time.
0 commit comments