Class: Workerholic::JobRetry
- Inherits:
-
Object
- Object
- Workerholic::JobRetry
- Defined in:
- lib/workerholic/job_retry.rb
Constant Summary collapse
- MAX_RETRY_ATTEMPTS =
5
Instance Attribute Summary collapse
-
#job ⇒ Object
readonly
Returns the value of attribute job.
-
#sorted_set ⇒ Object
readonly
Returns the value of attribute sorted_set.
-
#stats_storage ⇒ Object
readonly
Returns the value of attribute stats_storage.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ JobRetry
constructor
A new instance of JobRetry.
- #retry ⇒ Object
Constructor Details
Instance Attribute Details
#job ⇒ Object (readonly)
Returns the value of attribute job.
3 4 5 |
# File 'lib/workerholic/job_retry.rb', line 3 def job @job end |
#sorted_set ⇒ Object (readonly)
Returns the value of attribute sorted_set.
3 4 5 |
# File 'lib/workerholic/job_retry.rb', line 3 def sorted_set @sorted_set end |
#stats_storage ⇒ Object (readonly)
Returns the value of attribute stats_storage.
3 4 5 |
# File 'lib/workerholic/job_retry.rb', line 3 def stats_storage @stats_storage end |
Instance Method Details
#retry ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/workerholic/job_retry.rb', line 12 def retry return if job.retry_count >= MAX_RETRY_ATTEMPTS increment_retry_count schedule_job_for_retry Workerholic.manager .scheduler .schedule(JobSerializer.serialize(job), job.execute_at) end |