Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recodings sync, fix for #5871 #5954

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions lib/tasks/server_recordings_sync.rake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ desc 'Server Recordings sync with BBB server'
task :server_recordings_sync, %i[provider] => :environment do |_task, args|
args.with_defaults(provider: 'greenlight')

Room.select do |room|
room_recordings = room.recordings
Format.where(recording: room_recordings).delete_all
room_recordings.delete_all
end

Room.includes(:user).select(:id, :meeting_id).with_provider(args[:provider]).in_batches(of: 25) do |rooms|
meeting_ids = rooms.pluck(:meeting_id)

Expand All @@ -30,14 +36,7 @@ task :server_recordings_sync, %i[provider] => :environment do |_task, args|

next if recordings[:recordings].blank?

# Skip the entire batch if the first and last recordings exist
if Recording.exists?(record_id: recordings[:recordings][0][:recordID]) && Recording.exists?(record_id: recordings[:recordings][-1][:recordID])
next
end

recordings[:recordings].each do |recording|
next if Recording.exists?(record_id: recording[:recordID])

RecordingCreator.new(recording:).call
success 'Successfully migrated Recording:'
info "RecordID: #{recording[:recordID]}"
Expand Down
2 changes: 1 addition & 1 deletion spec/services/recordings_sync_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
allow_any_instance_of(BigBlueButtonApi).to receive(:get_recordings).and_return(no_recording_response)
end

it 'does not call RecordingsCreator service' do
it 'does not call RecordingsCreator service and delete all recordings' do
expect_any_instance_of(BigBlueButtonApi).to receive(:get_recordings).with(meeting_ids: room.meeting_id)
expect(RecordingCreator).not_to receive(:new)

Expand Down
Loading