You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: torrent_completion_worker.rb
    path of file: ./repos/muvee/app/workers
    
    the code of the file until where you have to start completion: class TorrentCompletionWorker
  include Sidekiq::Worker

  def perform
    return unless Rails.configuration.control_transmission
    
    Torrent.all.ea
    
  def perform
    return unless Rails.configuration.control_transmission
    
    Torrent.all.each do |torrent|
      status = torrent.completion_status
      if status == "missing"
        torrent.destroy
      elsif status == "complete"
        Rails.logger.info "Torrent complete, moving"
        torrent.finalize
      end
      torrent.video.try(:reanalyze)
    end