mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #32128 -- Added asgiref 3.3 compatibility.
Thread sensitive parameter is True by default from asgiref v3.3.0. Added an explicit thread_sensitive=False to previously implicit uses.
This commit is contained in:
committed by
Carlton Gibson
parent
0b4fe82c74
commit
e17ee44688
@@ -181,7 +181,7 @@ class AsyncClientHandler(BaseHandler):
|
||||
body_file = FakePayload('')
|
||||
|
||||
request_started.disconnect(close_old_connections)
|
||||
await sync_to_async(request_started.send)(sender=self.__class__, scope=scope)
|
||||
await sync_to_async(request_started.send, thread_sensitive=False)(sender=self.__class__, scope=scope)
|
||||
request_started.connect(close_old_connections)
|
||||
request = ASGIRequest(scope, body_file)
|
||||
# Sneaky little hack so that we can easily get round
|
||||
@@ -197,14 +197,14 @@ class AsyncClientHandler(BaseHandler):
|
||||
response.asgi_request = request
|
||||
# Emulate a server by calling the close method on completion.
|
||||
if response.streaming:
|
||||
response.streaming_content = await sync_to_async(closing_iterator_wrapper)(
|
||||
response.streaming_content = await sync_to_async(closing_iterator_wrapper, thread_sensitive=False)(
|
||||
response.streaming_content,
|
||||
response.close,
|
||||
)
|
||||
else:
|
||||
request_finished.disconnect(close_old_connections)
|
||||
# Will fire request_finished.
|
||||
await sync_to_async(response.close)()
|
||||
await sync_to_async(response.close, thread_sensitive=False)()
|
||||
request_finished.connect(close_old_connections)
|
||||
return response
|
||||
|
||||
|
||||
Reference in New Issue
Block a user