Skip to content

Commit

Permalink
fixup! 🐛(back) fix sync_medialive_video command
Browse files Browse the repository at this point in the history
  • Loading branch information
polyhb committed Jun 14, 2023
1 parent 2c37e42 commit f5d1c1f
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,8 @@ def handle(self, *args, **options):
# the channel name contains the environment, the primary key and the created_at
# stamp. Here we want to use the primary key
_environment, live_pk, _stamp = medialive_channel["Name"].split("_")
live = Video.objects.filter(pk=live_pk).first()
if not live:
# live exists in AWS but not our DB
self.stdout.write(
f"""Channel {medialive_channel["Name"]} is """
f"""attached to a video {live_pk} that does not exist"""
)
delete_medialive_stack(medialive_channel, self.stdout)
else:
try:
live = Video.objects.get(pk=live_pk)
self.stdout.write(f"Checking video {live.id}")
channel_state = medialive_channel.get("State").casefold()

Expand All @@ -110,3 +103,10 @@ def handle(self, *args, **options):
f"""{live_state} != {channel_state} (medialive)"""
)
self.update_video_state(live, channel_state)
except Video.DoesNotExist:
# live exists in AWS but not our DB
self.stdout.write(
f"""Channel {medialive_channel["Name"]} is """
f"""attached to a video {live_pk} that does not exist"""
)
delete_medialive_stack(medialive_channel, self.stdout)

0 comments on commit f5d1c1f

Please sign in to comment.