Sha256: 11263fd00409fa6418f31c8484375163b92469548533c3ec4eeee40c0c62d322

Contents?: true

Size: 856 Bytes

Versions: 10

Compression:

Stored size: 856 Bytes

Contents

module Resque
  module Failure
    # A Failure backend that stores exceptions in Redis. Very simple but
    # works out of the box, along with support in the Resque web app.
    class Redis < Base
      def save
        data = {
          :failed_at => Time.now.strftime("%Y/%m/%d %H:%M:%S"),
          :payload   => payload,
          :error     => exception.to_s,
          :backtrace => exception.backtrace,
          :worker    => worker.to_s,
          :queue     => queue
        }
        data = Resque.encode(data)
        Resque.redis.rpush(:failed, data)
      end

      def self.count
        Resque.redis.llen(:failed).to_i
      end

      def self.all(start = 0, count = 1)
        Resque.list_range(:failed, start, count)
      end
      
      def self.clear
        Resque.redis.delete('resque:failed')
      end
      
    end
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
scotttam-resque-0.0.5 lib/resque/failure/redis.rb
scotttam-resque-0.0.4 lib/resque/failure/redis.rb
scotttam-resque-0.0.3 lib/resque/failure/redis.rb
scotttam-resque-0.0.2 lib/resque/failure/redis.rb
scotttam-resque-0.0.1 lib/resque/failure/redis.rb
grockit-resque-1.5.0 lib/resque/failure/redis.rb
resque-1.5.0 lib/resque/failure/redis.rb
resque-1.4.0 lib/resque/failure/redis.rb
resque-1.3.1 lib/resque/failure/redis.rb
resque-1.3.0 lib/resque/failure/redis.rb