Django-channels 实例关闭时间过长而被杀死

问题描述 投票:0回答:1

谁能告诉我可能是什么问题?

警告应用程序实例 wait_for=> 连接 关闭时间过长并被终止。

我的阿斯吉

    "^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)```
python-3.x subscription django-channels strawberry-graphql
1个回答
0
投票

解决我的问题

daphne -b 0.0.0.0 -p $SERVER_PORT --application-close-timeout 60 --proxy-headers server.asgi:application

© www.soinside.com 2019 - 2024. All rights reserved.