Sha256: 0ef0766001b91a363dcf20f1348f1b62334333bee3419df53c349bc1394af940

Contents?: true

Size: 765 Bytes

Versions: 2

Compression:

Stored size: 765 Bytes

Contents

module QPush
  module Server
    module Apis
      class History < Base
        def initialize(job, status, error)
          @status = status
          @klass = job.klass
          @args = job.args
          @performed = Time.now.to_i
          @error = error ? error.message : nil
        end

        def call
          update_history
        end

        private

        def update_history
          Server.redis do |c|
            c.lpush(Server.keys[:history], to_json)
            c.ltrim(Server.keys[:history], 0, 10)
          end
        end

        def to_json
          { status: @status,
            klass: @klass,
            args: @args,
            performed: @performed,
            error: @error }.to_json
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qpush-0.1.10 lib/qpush/server/apis/history.rb
qpush-0.1.8 lib/qpush/server/apis/history.rb