python-3.x Django-channels示例关闭时间过长,已被杀死

oymdgrw7  于 4个月前  发布在  Python
关注(0)|答案(1)|浏览(84)

有谁能告诉我是什么问题吗?
已禁用应用程序示例<Task pending name ='Task-15'科罗=<ProtocolTypeRouter.call()运行于/usr/local/lib/python3.11/site-packages/channels/routing.py:62> wait_for=<Future pending cb=[_chain_future.._call_check_cancel()at /usr/local/lib/python3.11/pythcio/futures.py:387,Task.task_wakeup()]>>用于连接<WebRequest at 0x 7 f8 da 0 c16250 method=POST uri=/graphql/ clientproto=HTTP/1.1>的关闭时间过长,已被杀死。
美阿斯吉

"^subscription", channels_jwt_middleware(MyConsumer.as_asgi(schema=schema))
)

application = ProtocolTypeRouter({
    "http": django_asgi_app,
    "websocket":
        QueryAuthMiddleware(
            URLRouter([
                subscription_url,
            ])

    ),
})```

my custom MyConsumer

```class MyConsumer(GraphQLWSConsumer):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.profile_id = None

    async def __call__(self, scope, receive, send):
        user = scope.get("user", None)
        time_zone = await get_current_timezone(user)
        self.profile_id = scope.get("active_profile_id", None)
        self.timezone = time_zone if time_zone else settings.TIME_ZONE
        await super().__call__(scope, receive, send)

    async def connect(self):
        await super().connect()
        await change_status(True, self.profile_id)

    async def disconnect(self, close_code, *args, **kwargs):
        await super().disconnect(close_code)
        await change_status(False, self.profile_id)```

字符串

gmol1639

gmol16391#

解决我的问题
daphne -B 0.0.0.0-p $SERVER_PORT --application-close-timeout 60 --proxy-headers server.asgi:application

相关问题