[Catalyst-commits] r9719 - trunk/examples/SmokeServer/lib/SmokeServer/Model

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Fri Apr 17 13:02:55 GMT 2009


Author: t0m
Date: 2009-04-17 14:02:55 +0100 (Fri, 17 Apr 2009)
New Revision: 9719

Modified:
   trunk/examples/SmokeServer/lib/SmokeServer/Model/SmokeDB.pm
Log:
Not to be using all of my RAM please

Modified: trunk/examples/SmokeServer/lib/SmokeServer/Model/SmokeDB.pm
===================================================================
--- trunk/examples/SmokeServer/lib/SmokeServer/Model/SmokeDB.pm	2009-04-17 12:53:09 UTC (rev 9718)
+++ trunk/examples/SmokeServer/lib/SmokeServer/Model/SmokeDB.pm	2009-04-17 13:02:55 UTC (rev 9719)
@@ -55,6 +55,7 @@
 
     my $id       = $params{id};
     my $tag      = $params{tag};
+    my $limit    = $params{limit} || 30;
 
     my $smoke_rs = $params{rs} || $self->resultset("Smoke");
 
@@ -67,8 +68,8 @@
     if ( $tag ) {
         $smoke_rs = $smoke_rs->search({ "tag.name" => $tag }, { join => { smoke_tags => 'tag' } });
     }
-
-    return $smoke_rs;
+    $smoke_rs = $smoke_rs->search(undef, { order_by => 'me.id DESC'});
+    return $smoke_rs->slice(0, $limit);
 }
 
 sub add_smoke {




More information about the Catalyst-commits mailing list