Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def foo
- # do work here
- update_attribute :processed, true
- end
- Delayed::Job.enqueue InstructionRequestJob.new( p1, p2 )
- InstructionRequestJob perform
- - perform a task on a remote server
- - get a response
- - case response
- when OK
- update attribute ( as suggested)
- else
- # how many attempts ?
- if too_many_attempts
- update attribute
- destroy the job
- else
- reschedule the job for another attempt
- - end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement