require 'json'
require 'resque'
require 'resque-retry'
require 'net/http'
require 'digest/md5'

module JamRuby

  # periodically scheduled to find jobs that need retrying, and cleanup activities
  class AudioMixerRetry
    extend Resque::Plugins::JamLonelyJob

    @queue = :scheduled_audiomixer_retry

    @@log = Logging.logger[AudioMixerRetry]

    def self.lock_timeout
      # this should be enough time to make sure the job has finished, but not so long that the system isn't recovering from a abandoned job
      120
    end

    def self.perform
      AudioMixer.queue_jobs_needing_retry
      QuickMixer.queue_jobs_needing_retry
      QuickMix.cleanup_excessive_storage
    end

  end

end