Sha256: 14da726e84745e1a8a99d19b55bc8c23e5b0029ceade38d5f19ef901048f86bb
Contents?: true
Size: 1.9 KB
Versions: 1
Compression:
Stored size: 1.9 KB
Contents
module RailsPerformance module Models class DelayedJobRecord < BaseRecord attr_accessor :jid, :duration, :datetime, :datetimei, :source_type, :class_name, :method_name, :status, :json # delayed_job #|jid|22 #|datetime|20210415T0616 #|datetimei|1618492591 #|source_type|instance_method #|class_name|User #|method_name|say_hello_without_delay #|status|success|END|1.0.0 def DelayedJobRecord.from_db(key, value) items = key.split("|") DelayedJobRecord.new( jid: items[2], datetime: items[4], datetimei: items[6], source_type: items[8], class_name: items[10], method_name: items[12], status: items[14], json: value ) end def initialize(jid:, duration: nil, datetime:, datetimei:, source_type:, class_name:, method_name:, status:, json: '{}') @jid = jid @duration = duration @datetime = datetime @datetimei = datetimei.to_i @source_type = source_type @class_name = class_name @method_name = method_name @status = status @json = json end def record_hash { jid: jid, datetime: Time.at(datetimei), datetimei: datetimei, duration: value['duration'], status: status, source_type: source_type, class_name: class_name, method_name: method_name, } end def save key = "delayed_job|jid|#{jid}|datetime|#{datetime}|datetimei|#{datetimei}|source_type|#{source_type}|class_name|#{class_name}|method_name|#{method_name}|status|#{status}|END|#{RailsPerformance::VERSION}" value = { duration: duration } Utils.save_to_redis(key, value) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_performance-1.0.0.beta1 | lib/rails_performance/models/delayed_job_record.rb |