From: Guillaume Pellerin Date: Thu, 19 Jan 2023 13:28:59 +0000 (+0100) Subject: add specific channel communication layer through socket X-Git-Tag: 2.8.0~26 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=3bd56100118e5d11541ec0281ccf7ebdcbd62f6e;p=teleforma.git add specific channel communication layer through socket --- diff --git a/teleforma/models/core.py b/teleforma/models/core.py index c9b9fbba..72a382d3 100755 --- a/teleforma/models/core.py +++ b/teleforma/models/core.py @@ -459,7 +459,14 @@ class Conference(models.Model): # Notify live conferences by sending a signal to websocket. # This signal will be catched by the channel instance to notify students from teleforma.models.notification import notify - requests.post(f"{settings.CHANNEL_URL}{reverse('teleforma-live-conference-notify')}", {'id': self.id}) + if settings.DEBUG: + requests.post(f"{settings.CHANNEL_URL}{reverse('teleforma-live-conference-notify')}", {'id': self.id}) + else: + transport = httpx.HTTPTransport(uds=settings.CHANNEL_URL) + client = httpx.Client(transport=transport) + response = client.post(f"{reverse('teleforma-live-conference-notify')}", + {'id': self.id}) + assert response.status_code == 200 self.notified_live = True super(Conference, self).save(*args, **kwargs)