Mailing List Archive

svn commit: r434242 - in /spamassassin/branches/tvd-multi-mass-check: lib/Mail/SpamAssassin/ArchiveIterator.pm masses/mass-check
Author: felicity
Date: Wed Aug 23 16:21:12 2006
New Revision: 434242

URL: http://svn.apache.org/viewvc?rev=434242&view=rev
Log:
stop bothering with M::SA::AI::MESSAGES variable in mass-check, just deal with it locally

Modified:
spamassassin/branches/tvd-multi-mass-check/lib/Mail/SpamAssassin/ArchiveIterator.pm
spamassassin/branches/tvd-multi-mass-check/masses/mass-check

Modified: spamassassin/branches/tvd-multi-mass-check/lib/Mail/SpamAssassin/ArchiveIterator.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/tvd-multi-mass-check/lib/Mail/SpamAssassin/ArchiveIterator.pm?rev=434242&r1=434241&r2=434242&view=diff
==============================================================================
--- spamassassin/branches/tvd-multi-mass-check/lib/Mail/SpamAssassin/ArchiveIterator.pm (original)
+++ spamassassin/branches/tvd-multi-mass-check/lib/Mail/SpamAssassin/ArchiveIterator.pm Wed Aug 23 16:21:12 2006
@@ -271,8 +271,15 @@

my $messages;

- # message-array
+ # scan the targets and get the number and list of messages
($MESSAGES, $messages) = $self->message_array(\@targets);
+
+ # go ahead and run through all of the messages specified
+ return _run($messages);
+}
+
+sub _run {
+ my ($self, $messages) = @_;

while (my $message = shift @{$messages}) {
my($class, undef, $date, undef, $result) = $self->run_message($message);

Modified: spamassassin/branches/tvd-multi-mass-check/masses/mass-check
URL: http://svn.apache.org/viewvc/spamassassin/branches/tvd-multi-mass-check/masses/mass-check?rev=434242&r1=434241&r2=434242&view=diff
==============================================================================
--- spamassassin/branches/tvd-multi-mass-check/masses/mass-check (original)
+++ spamassassin/branches/tvd-multi-mass-check/masses/mass-check Wed Aug 23 16:21:12 2006
@@ -313,7 +313,9 @@

# If opt_j isn't given, just use the normal AI code ...
if ($opt_j == 0) {
- $iter->run(@targets);
+ my $messages;
+ ($total_messages, $messages) = $iter->message_array(\@targets);
+ $iter->_run($messages);
}
else {
my $tmpf;
@@ -341,9 +343,9 @@
# NOTE: do this here, not in message_array, since that will only affect
# the child.
seek($tmpfd, 0, 0);
- $Mail::SpamAssassin::ArchiveIterator::MESSAGES = $iter->read_line($tmpfd);
+ $total_messages = $iter->read_line($tmpfd);

- if (!$Mail::SpamAssassin::ArchiveIterator::MESSAGES) {
+ if (!$total_messages) {
die "archive-iterator: no messages to process\n";
}
# only do 1 process, message list in a temp file, no restarting
@@ -352,7 +354,7 @@
my $messages;
my $total_count = 0;

- while (($Mail::SpamAssassin::ArchiveIterator::MESSAGES > $total_count) && ($message = $iter->read_line($tmpfd))) {
+ while (($total_messages > $total_count) && ($message = $iter->read_line($tmpfd))) {
my($class, undef, $date, undef, $result) = $iter->run_message($message);
result($class, $result, $date) if $result;
$total_count++;
@@ -392,14 +394,14 @@
}

# if messages remain, and we don't need to restart, send message
- if (($Mail::SpamAssassin::ArchiveIterator::MESSAGES > $total_count) && !$needs_restart) {
+ if (($total_messages > $total_count) && !$needs_restart) {
$iter->send_line($socket, $iter->read_line($tmpfd));
$total_count++;
- #warn ">> recv: $MESSAGES $total_count\n";
+ #warn ">> recv: $total_messages $total_count\n";
}
else {
# stop listening on this child since we're done with it
- #warn ">> removeresult: $needs_restart $MESSAGES $total_count\n";
+ #warn ">> removeresult: $needs_restart $total_messages $total_count\n";
$select->remove($socket);
}

@@ -409,29 +411,28 @@
}
}
elsif ($line eq "START") {
- if ($Mail::SpamAssassin::ArchiveIterator::MESSAGES > $total_count) {
+ if ($total_messages > $total_count) {
# we still have messages, send one to child
$iter->send_line($socket, $iter->read_line($tmpfd));
$total_count++;
- #warn ">> new: $MESSAGES $total_count\n";
+ #warn ">> new: $total_messages $total_count\n";
}
else {
# no more messages, so stop listening on this child
- #warn ">> removestart: $needs_restart $MESSAGES $total_count\n";
+ #warn ">> removestart: $needs_restart $total_messages $total_count\n";
$select->remove($socket);
}
}
}

- #warn ">> out of loop, $MESSAGES $total_count $needs_restart ".$select->count()."\n";
+ #warn ">> out of loop, $total_messages $total_count $needs_restart ".$select->count()."\n";

# If there are still messages to process, and we need to restart
# the children, and all of the children are idle, let's go ahead.
- if ($needs_restart && $select->count == 0 &&
- $Mail::SpamAssassin::ArchiveIterator::MESSAGES > $total_count) {
+ if ($needs_restart && $select->count == 0 && $total_messages > $total_count) {
$needs_restart = 0;

- #warn "debug: needs restart, $MESSAGES total, $total_count done\n";
+ #warn "debug: needs restart, $total_messages total, $total_count done\n";
reap_children($opt_j, \@child, \@pid);
@child=();
@pid=();
@@ -484,9 +485,6 @@
$showdots_active = $opt_showdots;

if ($opt_progress) {
- # make it a local variable for now
- $total_messages = $Mail::SpamAssassin::ArchiveIterator::MESSAGES;
-
# round up since 100% will be caught at end already
$statusevery = int($total_messages / $updates + 1);