Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.16 KB | None | 0 0
  1. lock_file = Rails.root.join('tmp', job_id)
  2.  
  3. return if File.exists?(lock_file)
  4. File.touch(lock_file)
  5.  
  6. begin
  7. # do work
  8. ensure
  9. File.delete(lock_file)
  10. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement