Sha256: 2eab83025f90a0484cec0202438e6f23eaf506b9d78a4a930b9cf8ab63903ab4

Contents?: true

Size: 608 Bytes

Versions: 2

Compression:

Stored size: 608 Bytes

Contents

module Magent
  class Channel < GenericChannel
    def enqueue(message, args)
      super([message, args])
    end

    def failed(info)
      error_collection.save(info.merge({:channel_id => @name, :created_at => Time.now.utc}))
    end

    def errors(conds = {})
      page = conds.delete(:page) || 1
      per_page = conds.delete(:per_page) || 10

      error_collection.find({:channel_id => @name}, {:offset => (page-1)*per_page, :limit => per_page, :sort => ["created_at"]})
    end

    def error_collection
      @error_collection ||= Magent.database.collection("errors")
    end
  end # Channel
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
magent-0.1.2 lib/magent/channel.rb
magent-0.1.1 lib/magent/channel.rb