Skip to content

Commit

Permalink
record_set: fix multiple creation of them same record set
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippKilian authored and liske committed Sep 28, 2023
1 parent a1a35c8 commit 3b61f19
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions b3lb/rest/classes/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async def create(self) -> HttpResponse:

if created:
await sync_to_async(update_create_metrics)(self.secret, self.node)
await sync_to_async(self.check_parameters)(meeting)
await sync_to_async(self.check_parameters)(meeting, created)
return await self.pass_through()

async def join(self) -> HttpResponse:
Expand Down Expand Up @@ -313,7 +313,7 @@ def check_checksum(self) -> bool:
return True
return False

def check_parameters(self, meeting: Meeting = None):
def check_parameters(self, meeting: Meeting = None, created: bool = False):
parameters = Parameter.objects.filter(tenant=self.secret.tenant)
if self.endpoint == "join":
endpoint_parameters = Parameter.PARAMETERS_JOIN
Expand Down Expand Up @@ -354,8 +354,9 @@ def check_parameters(self, meeting: Meeting = None):

# check if records are enabled
if self.secret.is_record_enabled:
record_set = RecordSet.objects.create(secret=self.secret, meeting=meeting, meta_meeting_id=meeting.id, recording_ready_origin_url=self.parameters.pop("meta_bbb-recording-ready-url", ""), meta_end_callback_url=meeting.end_callback_url, nonce=meeting.nonce)
self.parameters[f"meta_{settings.B3LB_RECORD_META_DATA_TAG}"] = record_set.nonce
if created: # only if meeting has been created otherwise do nothing
record_set = RecordSet.objects.create(secret=self.secret, meeting=meeting, meta_meeting_id=meeting.id, recording_ready_origin_url=self.parameters.pop("meta_bbb-recording-ready-url", ""), meta_end_callback_url=meeting.end_callback_url, nonce=meeting.nonce)
self.parameters[f"meta_{settings.B3LB_RECORD_META_DATA_TAG}"] = record_set.nonce
else:
# record aren't enabled -> suppress any record related parameter
for param in [Parameter.RECORD, Parameter.ALLOW_START_STOP_RECORDING, Parameter.AUTO_START_RECORDING]:
Expand Down

0 comments on commit 3b61f19

Please sign in to comment.