lib/mail_engine/tasks/sendmail.rake in mail_engine-0.1.11 vs lib/mail_engine/tasks/sendmail.rake in mail_engine-0.1.12
- old
+ new
@@ -1,8 +1,12 @@
+require 'mail_engine/rake_locker'
namespace :mail_engine do
+ include MailEngine::RakeLocker
desc "Check mail schedule table and send the scheduled mail."
task :sendmail => :environment do
- puts "==== Start sending scheduled mail ===="
- MailEngine::MailSchedule.available.each { |schedule| schedule.sendmail }
- puts "==== End sending scheduled mail ===="
+ lock_task do
+ puts "==== Start sending scheduled mail ===="
+ MailEngine::MailSchedule.available.each { |schedule| schedule.sendmail }
+ puts "==== End sending scheduled mail ===="
+ end
end
end
\ No newline at end of file