module Recordings
  class UploadJob
    include Sidekiq::Job
    sidekiq_options retry: 3, queue: "default"

    def perform(session_id)
      session = StreamSession.find_by(id: session_id)
      return unless session

      Recordings::UploadFromSession.new(session).call
      Recordings::PurgeExpiredJob.perform_async
    end
  end
end
