You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2007/09/15 23:15:40 UTC
svn commit: r575984 - /spamassassin/trunk/masses/mass-check
Author: jm
Date: Sat Sep 15 14:15:39 2007
New Revision: 575984
URL: http://svn.apache.org/viewvc?rev=575984&view=rev
Log:
add connection retrying to mass-check, for the first connection only
Modified:
spamassassin/trunk/masses/mass-check
Modified: spamassassin/trunk/masses/mass-check
URL: http://svn.apache.org/viewvc/spamassassin/trunk/masses/mass-check?rev=575984&r1=575983&r2=575984&view=diff
==============================================================================
--- spamassassin/trunk/masses/mass-check (original)
+++ spamassassin/trunk/masses/mass-check Sat Sep 15 14:15:39 2007
@@ -1687,6 +1687,9 @@
die "Can't create tempdir" unless $tmpdir;
}
+ my $made_conn_once = 0;
+ my $conn_retries = 60; # 1 hour
+
# keep going until something stops us.
while (1) {
# if the number of messages to request is too much, bring it down
@@ -1717,9 +1720,25 @@
);
}
- # last if connection fails
- last unless ($socket);
+ if (!$socket) {
+ # if we haven't yet made a connection, keep retrying;
+ # this is probably the server still in "scan stage"
+ if (!$made_conn_once) {
+ if ($conn_retries-- >= 0) {
+ print "Failed to connect; sleeping for retry\n" if ($opt_noisy);
+ sleep 60;
+ next;
+ } else {
+ print "Failed to connect, giving up\n" if ($opt_noisy);
+ last;
+ }
+ }
+
+ # last if connection fails after scanning something
+ last;
+ }
+ $made_conn_once = 1;
print "Requesting $msgnum messages from server\n" if ($opt_noisy);
# make request, include and then drop results if there are any