Class: Sqewer::Resubmit
- Inherits:
-
Object
- Object
- Sqewer::Resubmit
- Defined in:
- lib/sqewer/resubmit.rb
Instance Attribute Summary collapse
-
#execute_after ⇒ Object
readonly
Returns the value of attribute execute_after.
-
#job ⇒ Object
readonly
Returns the value of attribute job.
Instance Method Summary collapse
-
#initialize(job_to_resubmit, execute_after_timestamp) ⇒ Resubmit
constructor
A new instance of Resubmit.
- #run(ctx) ⇒ Object
Constructor Details
#initialize(job_to_resubmit, execute_after_timestamp) ⇒ Resubmit
Returns a new instance of Resubmit.
6 7 8 9 |
# File 'lib/sqewer/resubmit.rb', line 6 def initialize(job_to_resubmit, ) @job = job_to_resubmit @execute_after = end |
Instance Attribute Details
#execute_after ⇒ Object (readonly)
Returns the value of attribute execute_after.
4 5 6 |
# File 'lib/sqewer/resubmit.rb', line 4 def execute_after @execute_after end |
#job ⇒ Object (readonly)
Returns the value of attribute job.
3 4 5 |
# File 'lib/sqewer/resubmit.rb', line 3 def job @job end |
Instance Method Details
#run(ctx) ⇒ Object
11 12 13 14 15 |
# File 'lib/sqewer/resubmit.rb', line 11 def run(ctx) # Take the maximum delay period SQS allows required_delay = (@execute_after - Time.now.to_i) ctx.submit!(@job, delay_seconds: required_delay) end |