Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. def foo
  2. # do work here
  3. update_attribute :processed, true
  4. end
  5.  
  6. Delayed::Job.enqueue InstructionRequestJob.new( p1, p2 )
  7.  
  8. InstructionRequestJob perform
  9. - perform a task on a remote server
  10. - get a response
  11. - case response
  12. when OK
  13. update attribute ( as suggested)
  14. else
  15. # how many attempts ?
  16. if too_many_attempts
  17. update attribute
  18. destroy the job
  19. else
  20. reschedule the job for another attempt
  21. - end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement