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
1716from django_guid import get_guid
1817from pulpcore .app .apps import MODULE_PLUGIN_VERSIONS
1918from pulpcore .app .models import Task , TaskGroup
20- from pulpcore .app .util import current_task , get_domain , get_prn , deprecation_logger
19+ from pulpcore .app .util import current_task , get_domain , get_prn
2120from pulpcore .constants import (
2221 TASK_FINAL_STATES ,
2322 TASK_INCOMPLETE_STATES ,
@@ -81,19 +80,11 @@ def _execute_task(task):
8180 immediate = task .immediate
8281 is_coroutine_fn = asyncio .iscoroutinefunction (func )
8382
84- if not is_coroutine_fn :
85- if immediate :
86- deprecation_logger .warning (
87- "Immediate tasks must be coroutine functions. "
88- "Support for non-coroutine immediate tasks will be dropped "
89- "in pulpcore 3.85."
90- )
91- func = sync_to_async (func )
92- is_coroutine_fn = True
93- else :
94- func (* args , ** kwargs )
83+ if immediate and not is_coroutine_fn :
84+ raise ValueError ("Immediate tasks must be async functions." )
9585
9686 if is_coroutine_fn :
87+ # both regular and immediate tasks can be coroutines, but only immediate must timeout
9788 _logger .debug ("Task is coroutine %s" , task .pk )
9889 coro = func (* args , ** kwargs )
9990 if immediate :
@@ -110,6 +101,8 @@ def _execute_task(task):
110101 timeout = IMMEDIATE_TIMEOUT ,
111102 )
112103 )
104+ else :
105+ func (* args , ** kwargs )
113106
114107 except Exception :
115108 exc_type , exc , tb = sys .exc_info ()
0 commit comments