Skip to content
This repository has been archived by the owner on Feb 6, 2022. It is now read-only.

Commit

Permalink
Add a "recover-timeout" option to allow recovering messages that have…
Browse files Browse the repository at this point in the history
… taken too long to send
  • Loading branch information
Ryan committed Jan 19, 2012
1 parent 8aa22a0 commit c848d00
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Command/SendEmailCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ protected function configure()
->setDescription('Sends emails from the spool')
->addOption('message-limit', 0, InputOption::VALUE_OPTIONAL, 'The maximum number of messages to send.')
->addOption('time-limit', 0, InputOption::VALUE_OPTIONAL, 'The time limit for sending messages (in seconds).')
->addOption('recover-timeout', 0, InputOption::VALUE_OPTIONAL, 'The timeout for recovering messages that have taken too long to send (in seconds).')
->setHelp(<<<EOF
The <info>swiftmailer:spool:send</info> command sends all emails from the spool.
<info>php app/console swiftmailer:spool:send --message-limit=10 --time-limit=10</info>
<info>php app/console swiftmailer:spool:send --message-limit=10 --time-limit=10 --recover-timeout=900</info>
EOF
)
Expand All @@ -57,6 +58,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
if ($spool instanceof \Swift_ConfigurableSpool) {
$spool->setMessageLimit($input->getOption('message-limit'));
$spool->setTimeLimit($input->getOption('time-limit'));
NULL !== $input->getOption('recover-timeout') ? $spool->recover($input->getOption('recover-timeout')) : $spool->recover();
}
$sent = $spool->flushQueue($this->getContainer()->get('swiftmailer.transport.real'));

Expand Down

0 comments on commit c848d00

Please sign in to comment.