about summary refs log tree commit diff
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-05-15 13:10:15 +0200
committerfranck cuny <franck@lumberjaph.net>2010-05-15 13:10:15 +0200
commit4369c15d1bc6d8b926711b871dab6f93889503f5 (patch)
treed090ae8d13761c27da2830299dc5a1fc548d8522
parentuse 'entity' to serialize response content (diff)
downloadpresque-4369c15d1bc6d8b926711b871dab6f93889503f5.tar.gz
mget and use entity
-rw-r--r--lib/presque/JobQueueHandler.pm21
1 files changed, 8 insertions, 13 deletions
diff --git a/lib/presque/JobQueueHandler.pm b/lib/presque/JobQueueHandler.pm
index 8ac29b3..8791655 100644
--- a/lib/presque/JobQueueHandler.pm
+++ b/lib/presque/JobQueueHandler.pm
@@ -23,21 +23,16 @@ sub get {
         $key,
         sub {
             my $size = shift;
-            $self->application->redis->get(
+            $self->application->redis->mget(
                 $processed,
+                $failed,
                 sub {
-                    my $processed_jobs = shift;
-                    $self->application->redis->get(
-                        $failed,
-                        sub {
-                            my $failed_jobs = shift;
-                            my $stats       = {
-                                queue_name    => $queue_name,
-                                job_count     => $size,
-                                job_failed    => $failed_jobs,
-                                job_processed => $processed_jobs,
-                            };
-                            $self->finish(JSON::encode_json $stats);
+                    my $res = shift;
+                    $self->entity(
+                        {   queue_name    => $queue_name,
+                            job_count     => $size,
+                            job_failed    => $res->[0],
+                            job_processed => $res->[1],
                         }
                     );
                 }