Sha256: 394a5f1b63905b5f0b143c02104a424590fee34ca6c5d9b8e81f9dda6690e7cd

Contents?: true

Size: 1.43 KB

Versions: 3

Compression:

Stored size: 1.43 KB

Contents

module ResqueAdmin
  module Failure
    # A Failure backend that uses multiple backends
    # delegates all queries to the first backend
    class Multiple < Base

      class << self
        attr_accessor :classes
      end

      def self.configure
        yield self
        ResqueAdmin::Failure.backend = self
      end

      def initialize(*args)
        super
        @backends = self.class.classes.map {|klass| klass.new(*args)}
      end

      def save
        @backends.each(&:save)
      end

      # The number of failures.
      def self.count(*args)
        classes.first.count(*args)
      end

      # Returns an array of all available failure queues
      def self.queues
        classes.first.queues
      end

      # Returns a paginated array of failure objects.
      def self.all(*args)
        classes.first.all(*args)
      end

      # Iterate across failed objects
      def self.each(*args, &block)
        classes.first.each(*args, &block)
      end

      # A URL where someone can go to view failures.
      def self.url
        classes.first.url
      end

      # Clear all failure objects
      def self.clear(*args)
        classes.first.clear(*args)
      end

      def self.requeue(*args)
        classes.first.requeue(*args)
      end

      def self.requeue_all
        classes.first.requeue_all
      end

      def self.remove(index, queue)
        classes.each { |klass| klass.remove(index) }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
resque_admin-1.0.5 lib/resque_admin/failure/multiple.rb
resque_admin-0.2.0 lib/resque_admin/failure/multiple.rb
resque_admin-2.4.4 lib/resque_admin/failure/multiple.rb