Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@hinke
Created March 11, 2011 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hinke/865976 to your computer and use it in GitHub Desktop.
Save hinke/865976 to your computer and use it in GitHub Desktop.
Our worker task for emails
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