[Cpan-forum-commit] rev 221 - in trunk: . lib/CPAN

svn at pti.co.il svn at pti.co.il
Thu Aug 31 14:30:16 IDT 2006


Author: gabor
Date: 2006-08-31 14:30:16 +0300 (Thu, 31 Aug 2006)
New Revision: 221

Modified:
   trunk/
   trunk/lib/CPAN/Forum.pm
Log:
add code to measure run time and long long running requests



Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:11107
   + 8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:11108

Modified: trunk/lib/CPAN/Forum.pm
===================================================================
--- trunk/lib/CPAN/Forum.pm	2006-08-31 11:30:12 UTC (rev 220)
+++ trunk/lib/CPAN/Forum.pm	2006-08-31 11:30:16 UTC (rev 221)
@@ -411,6 +411,7 @@
 
 sub cgiapp_init {
     my $self = shift;
+    $self->param('start_time', time);
     
     my $db_connect = $self->param("DB_CONNECT");
     CPAN::Forum::DBI->myinit($db_connect);
@@ -1558,6 +1559,13 @@
     # flush added as the Test::WWW::Mechanize::CGI did not work well without
     # it after we started to use file based session objects
     $self->session->flush();
+
+    my $ellapsed_time = time() - $self->param('start_time');
+    # first let's try to resolve the really big problems
+    if ($ellapsed_time > 3) {
+        my $rm = $self->get_current_runmode();
+        $self->log->warning("Long request. Ellapsed time: $ellapsed_time on run-mode: $rm, $ENV{PATH_INFO}"); 
+    }
 }
 
 sub _my_sendmail {



More information about the Cpan-forum-commit mailing list