]> git.parisson.com Git - teleforma.git/commitdiff
fix async conf notify method
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 19 Jan 2023 16:27:26 +0000 (17:27 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 19 Jan 2023 16:27:26 +0000 (17:27 +0100)
teleforma/models/core.py

index 0c4256307b5913902490e32dfc884acf6725f36c..4fcb9e40c8b63769bca7238f77f2e5a93b608d82 100755 (executable)
@@ -40,6 +40,7 @@ import os
 import string
 import random
 import requests
+import asyncio
 from teleforma.utils import guess_mimetypes
 
 import django.db.models as models
@@ -452,11 +453,7 @@ class Conference(models.Model):
                     str(date)]
         return ' - '.join(list)
 
-    def save(self, *args, **kwargs):
-        if not self.public_id:
-            self.public_id = get_random_hash()
-        self.course.save()
-
+    async def notify(self):
         if self.streaming and not self.notified_live:
             # Notify live conferences by sending a signal to websocket.
             # This signal will be catched by the channel instance to notify students
@@ -470,7 +467,12 @@ class Conference(models.Model):
                                             data={'id': self.id}, timeout=20.0)
                     # assert response.status_code == 200
             self.notified_live = True
-        
+
+    def save(self, *args, **kwargs):
+        if not self.public_id:
+            self.public_id = get_random_hash()
+        self.course.save()
+        self.notify()
         super(Conference, self).save(*args, **kwargs)
 
     def to_dict(self):