File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Removed support for synchronous immediate tasks.
Original file line number Diff line number Diff line change 88import traceback
99import tempfile
1010import threading
11- from asgiref .sync import sync_to_async
1211from gettext import gettext as _
1312
1413from django .conf import settings
2120 current_task ,
2221 get_domain ,
2322 get_prn ,
24- deprecation_logger ,
2523)
2624from pulpcore .constants import (
2725 TASK_FINAL_STATES ,
@@ -86,19 +84,11 @@ def _execute_task(task):
8684 immediate = task .immediate
8785 is_coroutine_fn = asyncio .iscoroutinefunction (func )
8886
89- if not is_coroutine_fn :
90- if immediate :
91- deprecation_logger .warning (
92- "Immediate tasks must be coroutine functions. "
93- "Support for non-coroutine immediate tasks will be dropped "
94- "in pulpcore 3.85."
95- )
96- func = sync_to_async (func )
97- is_coroutine_fn = True
98- else :
99- func (* args , ** kwargs )
87+ if immediate and not is_coroutine_fn :
88+ raise ValueError ("Immediate tasks must be async functions." )
10089
10190 if is_coroutine_fn :
91+ # both regular and immediate tasks can be coroutines, but only immediate must timeout
10292 _logger .debug ("Task is coroutine %s" , task .pk )
10393 coro = func (* args , ** kwargs )
10494 if immediate :
@@ -115,6 +105,8 @@ def _execute_task(task):
115105 timeout = IMMEDIATE_TIMEOUT ,
116106 )
117107 )
108+ else :
109+ func (* args , ** kwargs )
118110
119111 except Exception :
120112 exc_type , exc , tb = sys .exc_info ()
You can’t perform that action at this time.
0 commit comments