Created
March 11, 2011 14:57
-
-
Save hinke/865976 to your computer and use it in GitHub Desktop.
Our worker task for emails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc 'Work email queue' | |
task :emails => :environment do | |
`if [ ! -d "pids" ]; then mkdir pids; fi; echo "#{Process.pid}" > #{Rails.root}/pids/emails.pid` | |
Minion.job "emails" do |args| | |
logger.info "[#{Time.now}] Recieved queued item" | |
begin | |
UserMailer.deliver(args) | |
rescue Exception => exception | |
logger.info "Error, #{exception}" | |
raise exception | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment