[Jifty-commit] r4134 - in jifty/trunk: lib/Jifty/Plugin lib/Jifty/Plugin/LeakDetector

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Tue Sep 18 16:27:33 EDT 2007


Author: sartak
Date: Tue Sep 18 16:27:33 2007
New Revision: 4134

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/Makefile.PL
   jifty/trunk/lib/Jifty/Plugin/LeakDetector.pm
   jifty/trunk/lib/Jifty/Plugin/LeakDetector/Dispatcher.pm
   jifty/trunk/lib/Jifty/Plugin/LeakDetector/View.pm

Log:
 r42796 at onn:  sartak | 2007-09-18 16:27:18 -0400
 Some cleanups in LeakDetector


Modified: jifty/trunk/Makefile.PL
==============================================================================
--- jifty/trunk/Makefile.PL	(original)
+++ jifty/trunk/Makefile.PL	Tue Sep 18 16:27:33 2007
@@ -107,7 +107,8 @@
         recommends('Test::HTML::Lint'),
         recommends('Test::MockModule' => '0.05'),
         recommends('Test::MockObject' => '1.07'),
-        recommends('Module::Refresh' => '0.09')
+        recommends('Module::Refresh' => '0.09'),
+        recommends('Devel::Events' => '0.02'),
     ],
     'Development of the jifty framework' => [
         -default => 0,

Modified: jifty/trunk/lib/Jifty/Plugin/LeakDetector.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/LeakDetector.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/LeakDetector.pm	Tue Sep 18 16:27:33 2007
@@ -54,6 +54,7 @@
     my $size = total_size([ keys %$leaked ]) - $empty_array;
 
     push @requests, {
+        id => 1 + @requests,
         url => $cgi->url(-absolute=>1,-path_info=>1),
         size => $size,
         objects => Dumper($leaked),
@@ -83,10 +84,6 @@
 
 This makes the following URLs available:
 
-View any URL of your app and catch any leaked objects
-
-    http://your.app/leak/user/12
-
 View the top-level leak report (how much each request has leaked)
 
     http://your.app/leaks

Modified: jifty/trunk/lib/Jifty/Plugin/LeakDetector/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/LeakDetector/Dispatcher.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/LeakDetector/Dispatcher.pm	Tue Sep 18 16:27:33 2007
@@ -11,10 +11,10 @@
 
 # http://your.app/leaks/xxx -- display leak report for request ID xxx
 on 'leaks/#' => run {
-    my $leak = $Jifty::Plugin::LeakDetector::requests[$1]
+    abort(404) if $1 < 1;
+    my $leak = $Jifty::Plugin::LeakDetector::requests[$1 - 1]
         or abort(404);
     set leak => $leak;
-    set leakid => $1;
     show "leaks/one";
 };
 

Modified: jifty/trunk/lib/Jifty/Plugin/LeakDetector/View.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/LeakDetector/View.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/LeakDetector/View.pm	Tue Sep 18 16:27:33 2007
@@ -30,17 +30,17 @@
                     th { "URL" }
                 };
 
-                my $id = 0;
                 for (@Jifty::Plugin::LeakDetector::requests)
                 {
                     row {
-                        cell { a { attr { href => "leaks/$id" } $id } }
+                        cell { a { attr { href => "leaks/$_->{id}" }
+                                   $_->{id} } }
+
                         cell { $_->{leaks} }
                         cell { $_->{size} }
                         cell { $_->{time} }
                         cell { $_->{url} }
                     };
-                    ++$id;
                 }
             }
         }
@@ -49,16 +49,15 @@
 
 template 'leaks/one' => sub {
     my $leak = get 'leak';
-    my $id = get 'leakid';
 
     html {
         body {
-            h1 { "Leaks from Request $id" }
+            h1 { "Leaks from Request $leak->{id}" }
             ul {
                 li { "URL: $leak->{url}" }
                 li { "Time: $leak->{time}" }
                 li { "Objects leaked: $leak->{leaks}" }
-                li { "Total memory leaked: $leak->{size}" }
+                li { "Total memory leaked: $leak->{size} bytes" }
             }
             p { a { attr { href => "/leaks" } "Table of Contents" } }
             hr {}


More information about the Jifty-commit mailing list