move broadcast websocket out into its own process

This commit is contained in:
chris meyers
2020-02-14 16:12:04 -05:00
committed by Ryan Petrello
parent f5193e5ea5
commit 3c5c9c6fde
13 changed files with 76 additions and 57 deletions

View File

@@ -21,7 +21,7 @@ from channels.db import database_sync_to_async
from asgiref.sync import async_to_sync
from awx.main.channels import wrap_broadcast_msg
from awx.main.wsbroadcast import wrap_broadcast_msg
logger = logging.getLogger('awx.main.consumers')
@@ -106,11 +106,13 @@ class BroadcastConsumer(AsyncJsonWebsocketConsumer):
try:
WebsocketSecretAuthHelper.is_authorized(self.scope)
except Exception:
# TODO: log ip of connected client
logger.warn("Broadcast client failed to authorize.")
await self.close()
return
# TODO: log ip of connected client
logger.info("Client connected")
logger.info(f"Broadcast client connected.")
await self.accept()
await self.channel_layer.group_add(BROADCAST_GROUP, self.channel_name)