class QPush::Server::Apis::History

Public Class Methods

new(job, status, error) click to toggle source
# File lib/qpush/server/apis/history.rb, line 5
def initialize(job, status, error)
  @status = status
  @klass = job.klass
  @args = job.args
  @performed = Time.now.to_i
  @error = error ? error.message : nil
end

Public Instance Methods

call() click to toggle source
# File lib/qpush/server/apis/history.rb, line 13
def call
  update_history
end

Private Instance Methods

to_json() click to toggle source
# File lib/qpush/server/apis/history.rb, line 26
def to_json
  { status: @status,
    klass: @klass,
    args: @args,
    performed: @performed,
    error: @error }.to_json
end
update_history() click to toggle source
# File lib/qpush/server/apis/history.rb, line 19
def update_history
  Server.redis do |c|
    c.lpush(Server.keys[:history], to_json)
    c.ltrim(Server.keys[:history], 0, 10)
  end
end