link-checker commit: Make number of cached connections configurable, bump default to 2.

changeset:   394:e1fc47d7f54a
user:        Ville Skyttä <ville.skytta@iki.fi>
date:        Mon Mar 28 01:00:34 2011 +0300
files:       bin/checklink bin/checklink.pod etc/checklink.conf
description:
Make number of cached connections configurable, bump default to 2.


diff -r 4e6def200601 -r e1fc47d7f54a bin/checklink
--- a/bin/checklink	Tue Mar 22 22:27:13 2011 +0200
+++ b/bin/checklink	Mon Mar 28 01:00:34 2011 +0300
@@ -401,6 +401,7 @@
     Hide_Same_Realm => 0,
     Depth                    => 0,             # < 0 means unlimited recursion.
     Sleep_Time               => 1,
+    Connection_Cache_Size    => 2,
     Max_Documents            => 150,           # For the online version.
     User                     => undef,
     Password                 => undef,
@@ -446,8 +447,7 @@
 
 my $ua = W3C::UserAgent->new($AGENT);    # @@@ TODO: admin address
 
-# @@@ make number of keep-alive connections customizable
-$ua->conn_cache({total_capacity => 1});    # 1 keep-alive connection
+$ua->conn_cache({total_capacity => $Opts{Connection_Cache_Size}});
 if ($ua->can('delay')) {
     $ua->delay($Opts{Sleep_Time} / 60);
 }
@@ -721,6 +721,7 @@
         'u|user=s'                    => \$Opts{User},
         'p|password=s'                => \$Opts{Password},
         't|timeout=i'                 => \$Opts{Timeout},
+        'C|connection-cache=i'        => \$Opts{Connection_Cache_Size},
         'S|sleep=i'                   => \$Opts{Sleep_Time},
         'L|languages=s'               => \$Opts{Accept_Language},
         'c|cookies=s'                 => \$Opts{Cookies},
diff -r 4e6def200601 -r e1fc47d7f54a bin/checklink.pod
--- a/bin/checklink.pod	Tue Mar 22 22:27:13 2011 +0200
+++ b/bin/checklink.pod	Mon Mar 28 01:00:34 2011 +0300
@@ -160,6 +160,12 @@
 
 Timeout for requests, in seconds.  The default is 30.
 
+=item B<-C, --connection-cache> I<number>
+
+Maximum number of cached connections.  Using this option overrides the
+C<Connection_Cache_Size> configuration file parameter, see its
+documentation below for the default value and more information.
+
 =item B<-d, --domain> I<domain>
 
 Perl regular expression describing the domain to which the authentication
@@ -240,6 +246,12 @@
 
    Doc_URI = http://validator.w3.org/docs/checklink.html
 
+C<Connection_Cache_Size> is an integer denoting the maximum number of
+connections the link checker will keep open at any given time.  The
+default is:
+
+   Connection_Cache_Size = 2
+
 =back
 
 =head1 ENVIRONMENT
diff -r 4e6def200601 -r e1fc47d7f54a etc/checklink.conf
--- a/etc/checklink.conf	Tue Mar 22 22:27:13 2011 +0200
+++ b/etc/checklink.conf	Mon Mar 28 01:00:34 2011 +0300
@@ -61,3 +61,11 @@
 #
 # Default:
 # Forbidden_Protocols = javascript,mailto
+
+
+#
+# Connection_Cache_Size is an integer denoting the maximum number of
+# connections the link checker will keep open at any given time.
+#
+# Default:
+# Connection_Cache_Size = 2

Received on Monday, 28 March 2011 20:49:15 UTC