[Catalyst-commits] r7770 - in Catalyst-Plugin-AutoRestart/1.000/trunk: . lib/Catalyst/Plugin

jgoulah at dev.catalyst.perl.org jgoulah at dev.catalyst.perl.org
Wed May 21 16:34:51 BST 2008


Author: jgoulah
Date: 2008-05-21 16:34:51 +0100 (Wed, 21 May 2008)
New Revision: 7770

Modified:
   Catalyst-Plugin-AutoRestart/1.000/trunk/Changes
   Catalyst-Plugin-AutoRestart/1.000/trunk/lib/Catalyst/Plugin/AutoRestart.pm
Log:
fix bug where plugin was looking for autorestart not Plugin::AutoRestart in config

Modified: Catalyst-Plugin-AutoRestart/1.000/trunk/Changes
===================================================================
--- Catalyst-Plugin-AutoRestart/1.000/trunk/Changes	2008-05-21 15:23:23 UTC (rev 7769)
+++ Catalyst-Plugin-AutoRestart/1.000/trunk/Changes	2008-05-21 15:34:51 UTC (rev 7770)
@@ -1,3 +1,6 @@
 
+0.91	2008-05-21 
+		- Actually read the config correctly 
+
 0.90	2008-05-16 
 		- Initial release.

Modified: Catalyst-Plugin-AutoRestart/1.000/trunk/lib/Catalyst/Plugin/AutoRestart.pm
===================================================================
--- Catalyst-Plugin-AutoRestart/1.000/trunk/lib/Catalyst/Plugin/AutoRestart.pm	2008-05-21 15:23:23 UTC (rev 7769)
+++ Catalyst-Plugin-AutoRestart/1.000/trunk/lib/Catalyst/Plugin/AutoRestart.pm	2008-05-21 15:34:51 UTC (rev 7770)
@@ -6,7 +6,7 @@
 use Text::SimpleTable;
 use Proc::ProcessTable;
 
-our $VERSION = '0.90';
+our $VERSION = '0.91';
 
 =head1 NAME
 
@@ -77,7 +77,7 @@
 
 sub setup {
 	my $c = shift @_;
-	my $config = $c->config->{'autorestart'} || {};
+	my $config = $c->config->{'Plugin::AutoRestart'} || {};
 
 	$config->{_process_table} = Proc::ProcessTable->new;
     
@@ -99,13 +99,14 @@
 sub handle_request {
 	my ($c, @args) = (shift,  @_); 
 	my $ret = $c->next::method(@args);
+	my $config = $c->config->{'Plugin::AutoRestart'} || {};
 	    
 	return $ret
-	 unless $c->config->{autorestart}{active};
+	 unless $config->{active};
 	 
-	my $check_each = $c->config->{autorestart}{check_each};
+	my $check_each = $config->{check_each};
      
-	if($Catalyst::COUNT > $c->config->{autorestart}{min_handled_requests}){
+	if($Catalyst::COUNT > $config->{min_handled_requests}){
 		if ($Catalyst::COUNT/$check_each == int($Catalyst::COUNT/$check_each)) { 
 			$c->log->warn('Checking Memory Size.');
 
@@ -113,9 +114,9 @@
 			
 			$c->log->warn("Found size is $size");
 			
-			if(defined $size && $size > $c->config->{autorestart}{max_bits} ) {
+			if(defined $size && $size > $config->{max_bits} ) {
 				# this actually wont output to log since it exits
-				$c->log->warn("$size is bigger than: ".$c->config->{autorestart}{max_bits}. "exiting now...");
+				$c->log->warn("$size is bigger than: ".$config->{max_bits}. "exiting now...");
 				exit(0);
 			}
 		}
@@ -133,8 +134,9 @@
 
 sub _debug_process_table {
 	my ($c) = @_;
+	my $config = $c->config->{'Plugin::AutoRestart'} || {};
 	
-	foreach my $p ( @{$c->config->{autorestart}{_process_table}->table} ) {
+	foreach my $p ( @{$config->{_process_table}->table} ) {
 		next
 		 unless $p->pid == $$;
 		 




More information about the Catalyst-commits mailing list