[channels] Use async def instead of a decorator (#15590)

This commit is contained in:
Sebastian Rittau authored and GitHub committed 2026-04-01 15:22:32 +02:00
1 parent 08628cee95
commit 1004155b8e
2 files changed
+5 -3

No files matched your search

+1 -3
View File
@@ -3,7 +3,6 @@ from typing import Any, ClassVar, Protocol, TypedDict, type_check_only
from asgiref.typing import ASGIReceiveCallable, ASGISendCallable, Scope, WebSocketScope
from channels.auth import UserLazyObject
from channels.db import database_sync_to_async
from channels.layers import BaseChannelLayer
from django.contrib.sessions.backends.base import SessionBase
from django.utils.functional import LazyObject
@@ -70,6 +69,5 @@ class SyncConsumer(AsyncConsumer):
# Since we're overriding asynchronous methods with synchronous ones,
# we need to use `# type: ignore[override]` to suppress mypy errors.
@database_sync_to_async
def dispatch(self, message: dict[str, Any]) -> None: ... # type: ignore[override]
async def dispatch(self, message: dict[str, Any]) -> None: ... # type: ignore[override]
def send(self, message: dict[str, Any]) -> None: ... # type: ignore[override]