Compare commits
2 Commits
change-big
...
gracefully
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
848c02d88f | ||
|
|
56b66bbf67 |
@@ -60,10 +60,16 @@ class StreamNotificationsController < ApplicationController
|
||||
def set_broadcast
|
||||
if notification_type == "video.asset.static_renditions.ready"
|
||||
live_stream_id = notification.dig(:stream_notification, :data, :live_stream_id)
|
||||
@broadcast = Broadcast.find_by!(stream_uid: live_stream_id)
|
||||
@broadcast = Broadcast.find_by(stream_uid: live_stream_id)
|
||||
else
|
||||
@broadcast = Broadcast.find_by!(stream_uid: notification_object_id)
|
||||
@broadcast = Broadcast.find_by(stream_uid: notification_object_id)
|
||||
end
|
||||
|
||||
if @broadcast.nil?
|
||||
logger.info "Ignoring broadcast from other environment. Type = #{notification_type}. Id = #{live_stream_id} / #{notification_object_id}"
|
||||
head :ok
|
||||
end
|
||||
head :ok if @broadcast.nil?
|
||||
end
|
||||
|
||||
def notify_users
|
||||
|
||||
@@ -7,6 +7,7 @@ RSpec.describe StreamNotificationsController, type: :controller do
|
||||
let(:active_status) { {type: "video.live_stream.active", object: { id: "mux_stream" }} }
|
||||
let(:disconnected_status) { {type: "video.live_stream.disconnected", object: { id: "mux_stream" }} }
|
||||
let(:idle_status) { {type: "video.live_stream.idle", object: { id: "mux_stream" }} }
|
||||
let(:idle_status_for_unknown_broadcast) { {type: "video.live_stream.idle", object: { id: "unknown-id" }} }
|
||||
let(:asset_ready) { {
|
||||
type: "video.asset.static_renditions.ready",
|
||||
object: { id: "asset_uid" },
|
||||
@@ -59,6 +60,12 @@ RSpec.describe StreamNotificationsController, type: :controller do
|
||||
|
||||
expect(BroadcastsChannel).to have_received(:stream_recording_ready)
|
||||
end
|
||||
|
||||
it "returns OK response even for non-existing broadcast" do
|
||||
post :create, params: idle_status_for_unknown_broadcast
|
||||
|
||||
expect(response).to be_successful
|
||||
end
|
||||
end
|
||||
|
||||
after do
|
||||
|
||||
Reference in New Issue
Block a user