Class: SidekiqJobStats::History
- Inherits:
-
Object
- Object
- SidekiqJobStats::History
- Defined in:
- lib/sidekiq_job_stats/history.rb
Instance Attribute Summary collapse
-
#job_class ⇒ Object
Returns the value of attribute job_class.
Instance Method Summary collapse
- #histories_recordable ⇒ Object
- #histories_recorded ⇒ Object
-
#initialize(job_class) ⇒ History
constructor
A new instance of History.
- #job_histories(start = 0, limit = 100) ⇒ Object
- #track(job_data) ⇒ Object
Constructor Details
#initialize(job_class) ⇒ History
Returns a new instance of History.
5 6 7 |
# File 'lib/sidekiq_job_stats/history.rb', line 5 def initialize(job_class) @job_class = job_class end |
Instance Attribute Details
#job_class ⇒ Object
Returns the value of attribute job_class.
3 4 5 |
# File 'lib/sidekiq_job_stats/history.rb', line 3 def job_class @job_class end |
Instance Method Details
#histories_recordable ⇒ Object
13 14 15 |
# File 'lib/sidekiq_job_stats/history.rb', line 13 def histories_recordable @histories_recordable || 100 end |
#histories_recorded ⇒ Object
23 24 25 26 27 |
# File 'lib/sidekiq_job_stats/history.rb', line 23 def histories_recorded Sidekiq.redis do |conn| conn.llen(job_history_key) end end |
#job_histories(start = 0, limit = 100) ⇒ Object
17 18 19 20 21 |
# File 'lib/sidekiq_job_stats/history.rb', line 17 def job_histories(start = 0, limit = 100) Sidekiq.redis do |conn| conn.lrange(job_history_key, start, start + limit - 1).map { |h| JSON.parse(h) } end end |
#track(job_data) ⇒ Object
9 10 11 |
# File 'lib/sidekiq_job_stats/history.rb', line 9 def track(job_data) push_history(job_data) end |