Committer: vad
LJSUP-7095: restore Author and Copyrights blocks.U trunk/lib/TheSchwartz/Worker/SendEmail.pm
Modified: trunk/lib/TheSchwartz/Worker/SendEmail.pm =================================================================== --- trunk/lib/TheSchwartz/Worker/SendEmail.pm 2010-10-08 09:54:24 UTC (rev 13) +++ trunk/lib/TheSchwartz/Worker/SendEmail.pm 2010-10-08 15:06:42 UTC (rev 14) @@ -105,12 +105,8 @@ my $client = $job->handle->client; my $rcpts = $args->{rcpts}; # arrayref of recipients OR rcpt -use Data::Dumper; -warn "RCPTS: start=" . Dumper($rcpts); - ## if (ref $rcpts eq 'ARRAY' and @$rcpts > 1){ -warn "SPLITTING: " . Dumper($rcpts); $0 = "send-email [splitting]"; my @new_jobs; foreach my $rcpt (@$rcpts) { @@ -134,51 +130,9 @@ ## Only one rcpt my $rcpt = ref $rcpts eq 'ARRAY' ? $rcpts->[0] : $rcpts; -warn "rcpt: $rcpt"; my ($host) = $rcpt =~ /\@(.+?)$/; -warn "host: $host"; return $job->completed unless $host; -=head - my %dom_rcpts; # domain -> [ $rcpt, ... ] - foreach my $to (@$rcpts) { - my ($host) = $to =~ /\@(.+?)$/; - next unless $host; - $host = lc $host; - - $dom_rcpts{$host} ||= []; - push @{$dom_rcpts{$host}}, $to; - } - - # uh, whack. - unless (%dom_rcpts) { - # FIXME: log or something. for artur. - $job->completed; - return; - } - - # split into jobs per host. - if (scalar keys %dom_rcpts > 1) { - $0 = "send-email [splitting]"; - my @new_jobs; - foreach my $dom (keys %dom_rcpts) { - my $new_args = Storable::dclone($args); - $new_args->{rcpts} = $dom_rcpts{$dom}; - my $new_job = TheSchwartz::Job->new( - funcname => 'TheSchwartz::Worker::SendEmail', - arg => $new_args, - coalesce => "$dom\@", - ); - push @new_jobs, $new_job; - } - $job->replace_with(@new_jobs); - return; - } - - # all rcpts on same server, proceed... - (my($host), $rcpts) = %dom_rcpts; # (there's only one key) -=cut - $0 = "send-email [$host]"; ## @@ -243,5 +197,24 @@ +=head1 AUTHOR +Brad Fitzpatrick -- brad@danga.com + +=head1 COPYRIGHT, LICENSE, and WARRANTY + +Copyright 2006-2007, SixApart, Ltd. + +License to use under the same terms as Perl itself. + +This software comes with no warranty of any kind. + +=head1 SEE ALSO + +L<TheSchwartz> + +=cut + + + 1;