Class: FeedJob
- Inherits:
-
Struct
- Object
- Struct
- FeedJob
- Defined in:
- app/jobs/feed_job.rb
Overview
To create outside of Rails, insert a row with values for the following columns into the ‘delayed_jobs` table:
handler: {see h7_message_example.yml}
run_at: {current_time e.g. NOW() AT TIME ZONE 'UTC'}
Notes:
-
the key ‘raw_message` for the `handler` column must have line endings “n”
-
to run delayed_jobs see in development use rake jobs:work
Instance Attribute Summary collapse
-
#raw_message ⇒ Object
Returns the value of attribute raw_message.
Instance Method Summary collapse
- #destroy_failed_jobs? ⇒ Boolean
- #max_attempts ⇒ Object
- #perform ⇒ Object
-
#reschedule_at(current_time, attempts) ⇒ Object
Reschedule after an error.
Instance Attribute Details
#raw_message ⇒ Object
Returns the value of attribute raw_message
14 15 16 |
# File 'app/jobs/feed_job.rb', line 14 def @raw_message end |
Instance Method Details
#destroy_failed_jobs? ⇒ Boolean
23 24 25 |
# File 'app/jobs/feed_job.rb', line 23 def destroy_failed_jobs? false end |
#max_attempts ⇒ Object
19 20 21 |
# File 'app/jobs/feed_job.rb', line 19 def max_attempts 2 end |
#perform ⇒ Object
15 16 17 |
# File 'app/jobs/feed_job.rb', line 15 def perform Renalware::Feeds..call() end |
#reschedule_at(current_time, attempts) ⇒ Object
Reschedule after an error. No point trying straight away, so try at these intervals: After attempt no. Wait for hours
1 2 2 17 Then give up. Note e.g. attempts**4 == attempts to the power of 4
34 35 36 |
# File 'app/jobs/feed_job.rb', line 34 def reschedule_at(current_time, attempts) current_time + ((attempts**4) + 1).hours end |