Django channels 运行 三个工人,正常吗?
Django channels run three workers, is it normal?
我有一个非常简单的 Django 项目设置,其中包含使用文档的频道
https://channels.readthedocs.io/en/stable/getting-started.html
在设置中:
CHANNEL_LAYERS = {
"default": {
"BACKEND": "asgiref.inmemory.ChannelLayer",
"ROUTING": "core.routing.channel_routing",
},
}
在rounting.py中:
from channels.routing import route
from apps.prices.consumers import get_prices
channel_routing = [
route('get_prices', get_prices),
]
当我 运行:
python manage.py runserver
它打印:
2016-12-24 23:49:05,202 - INFO - worker - Listening on channels get_prices, http.request, websocket.connect, websocket.receive
2016-12-24 23:49:05,202 - INFO - worker - Listening on channels get_prices, http.request, websocket.connect, websocket.receive
2016-12-24 23:49:05,203 - INFO - worker - Listening on channels get_prices, http.request, websocket.connect, websocket.receive
2016-12-24 23:49:05,207 - INFO - server - Using busy-loop synchronous mode on channel layer
而且三个工人似乎出了问题,还是很正常?
但其他一切正常。
非常感谢您的建议
在本地,当我 运行 ./manage.py runserver
命令时,默认情况下我有 4 个工人。
可能是通道上的这一行 运行 服务器命令 - https://github.com/django/channels/blob/a3f4e002eeebbf7c2412d9623e4e9809cfe32ba5/channels/management/commands/runserver.py#L80
要有一个工人 运行ning 你可以使用通道命令 ./manage.py runworker
。
我有一个非常简单的 Django 项目设置,其中包含使用文档的频道 https://channels.readthedocs.io/en/stable/getting-started.html
在设置中:
CHANNEL_LAYERS = {
"default": {
"BACKEND": "asgiref.inmemory.ChannelLayer",
"ROUTING": "core.routing.channel_routing",
},
}
在rounting.py中:
from channels.routing import route
from apps.prices.consumers import get_prices
channel_routing = [
route('get_prices', get_prices),
]
当我 运行:
python manage.py runserver
它打印:
2016-12-24 23:49:05,202 - INFO - worker - Listening on channels get_prices, http.request, websocket.connect, websocket.receive
2016-12-24 23:49:05,202 - INFO - worker - Listening on channels get_prices, http.request, websocket.connect, websocket.receive
2016-12-24 23:49:05,203 - INFO - worker - Listening on channels get_prices, http.request, websocket.connect, websocket.receive
2016-12-24 23:49:05,207 - INFO - server - Using busy-loop synchronous mode on channel layer
而且三个工人似乎出了问题,还是很正常? 但其他一切正常。
非常感谢您的建议
在本地,当我 运行 ./manage.py runserver
命令时,默认情况下我有 4 个工人。
可能是通道上的这一行 运行 服务器命令 - https://github.com/django/channels/blob/a3f4e002eeebbf7c2412d9623e4e9809cfe32ba5/channels/management/commands/runserver.py#L80
要有一个工人 运行ning 你可以使用通道命令 ./manage.py runworker
。