MCPcopy
hub / github.com/django/django / get_response_async

Method get_response_async

django/core/handlers/base.py:154–174  ·  view source on GitHub ↗

Asynchronous version of get_response. Funneling everything, including WSGI, into a single async get_response() is too slow. Avoid the context switch by using a separate async response path.

(self, request)

Source from the content-addressed store, hash-verified

152 return response
153
154 async def get_response_async(self, request):
155 """
156 Asynchronous version of get_response.
157
158 Funneling everything, including WSGI, into a single async
159 get_response() is too slow. Avoid the context switch by using
160 a separate async response path.
161 """
162 # Setup default url resolver for this thread.
163 set_urlconf(settings.ROOT_URLCONF)
164 response = await self._middleware_chain(request)
165 response._resource_closers.append(request.close)
166 if response.status_code >= 400:
167 await sync_to_async(log_response, thread_sensitive=False)(
168 "%s: %s",
169 response.reason_phrase,
170 request.path,
171 response=response,
172 request=request,
173 )
174 return response
175
176 def _get_response(self, request):
177 """

Callers 2

run_get_responseMethod · 0.45
__call__Method · 0.45

Calls 2

set_urlconfFunction · 0.90
appendMethod · 0.45

Tested by

no test coverage detected