Skip to content

Commit

Permalink
Improved sync of recordings with BBB server
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianAppDev committed Sep 20, 2024
1 parent ab9781e commit 928278d
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/tasks/server_recordings_sync.rake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ task :server_recordings_sync, %i[provider] => :environment do |_task, args|
args.with_defaults(provider: 'greenlight')

Room.includes(:user).select(:id, :meeting_id).with_provider(args[:provider]).in_batches(of: 25) do |rooms|
room_recordings = rooms.recordings
Format.where(recording: room_recordings).delete_all
room_recordings.delete_all

meeting_ids = rooms.pluck(:meeting_id)

recordings = BigBlueButtonApi.new(provider: args[:provider]).get_recordings(meeting_ids:)
Expand All @@ -30,14 +34,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

0 comments on commit 928278d

Please sign in to comment.