﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
32172	Adapt signals to allow async handlers	Carlton Gibson	nobody	"Currently (circa 3.1) we have a couple of `sync_to_async()` usages in [https://github.com/django/django/blob/009fddc96b88a9aee1232d6a2637f2970fdcfb50/django/core/handlers/asgi.py#L154 the main line of `ASGIHandler.__call__()`], for the request life cycle signals:

{{{
        await sync_to_async(signals.request_started.send, thread_sensitive=True)(sender=self.__class__, scope=scope)
}}}

Much as is done of the middleware, [https://github.com/django/django/blob/76181308fb02e67794d0cc1471766a5d7e4c877e/django/core/handlers/base.py#L26 adapting to accept either synchronous or asynchronous middleware classes], it would be good to be able to push that `sync_to_async()` call down into the `send()` method, allowing signal handlers to be either sync (as now) or async coroutines. 

This would give us the option of having a completely async request pathway, if we were to remove all synchronous middleware and signal handlers. 

There will need to be some discussion, perhaps on a PR, or the [https://forum.djangoproject.com/c/internals/async/8 Forum's Async category] but opening this ticket to track efforts. "	New feature	new	Core (Other)	dev	Normal		async	Andrew Godwin	Unreviewed	0	0	0	0	0	0
