Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lock_file = Rails.root.join('tmp', job_id)
- return if File.exists?(lock_file)
- File.touch(lock_file)
- begin
- # do work
- ensure
- File.delete(lock_file)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement