Use async email deliveries in rake tasks (#16784).

git-svn-id: http://svn.redmine.org/redmine/trunk@13123 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2014-05-02 07:07:02 +00:00
parent bcc5ac38f3
commit 2d3f3cd9aa
1 changed files with 9 additions and 3 deletions

View File

@ -55,8 +55,10 @@ Examples:
END_DESC END_DESC
task :read => :environment do task :read => :environment do
Mailer.with_synched_deliveries do
MailHandler.receive(STDIN.read, MailHandler.extract_options_from_env(ENV)) MailHandler.receive(STDIN.read, MailHandler.extract_options_from_env(ENV))
end end
end
desc <<-END_DESC desc <<-END_DESC
Read emails from an IMAP server. Read emails from an IMAP server.
@ -122,8 +124,10 @@ END_DESC
:move_on_success => ENV['move_on_success'], :move_on_success => ENV['move_on_success'],
:move_on_failure => ENV['move_on_failure']} :move_on_failure => ENV['move_on_failure']}
Mailer.with_synched_deliveries do
Redmine::IMAP.check(imap_options, MailHandler.extract_options_from_env(ENV)) Redmine::IMAP.check(imap_options, MailHandler.extract_options_from_env(ENV))
end end
end
desc <<-END_DESC desc <<-END_DESC
Read emails from an POP3 server. Read emails from an POP3 server.
@ -149,8 +153,10 @@ END_DESC
:password => ENV['password'], :password => ENV['password'],
:delete_unprocessed => ENV['delete_unprocessed']} :delete_unprocessed => ENV['delete_unprocessed']}
Mailer.with_synched_deliveries do
Redmine::POP3.check(pop_options, MailHandler.extract_options_from_env(ENV)) Redmine::POP3.check(pop_options, MailHandler.extract_options_from_env(ENV))
end end
end
desc "Send a test email to the user with the provided login name" desc "Send a test email to the user with the provided login name"
task :test, [:login] => :environment do |task, args| task :test, [:login] => :environment do |task, args|