about summary refs log tree commit diff
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-05-15 13:53:16 +0200
committerfranck cuny <franck@lumberjaph.net>2010-05-15 13:53:16 +0200
commita221f4a924a04359cc0698b5e2c88fa09f894118 (patch)
treea965a65db0b40f6aff48bbe08c042ce30b47d449
parentupdate POD (diff)
downloadpresque-a221f4a924a04359cc0698b5e2c88fa09f894118.tar.gz
add POD
-rw-r--r--lib/presque/StatusHandler.pm18
1 files changed, 6 insertions, 12 deletions
diff --git a/lib/presque/StatusHandler.pm b/lib/presque/StatusHandler.pm
index 6e846d2..ee0abce 100644
--- a/lib/presque/StatusHandler.pm
+++ b/lib/presque/StatusHandler.pm
@@ -10,10 +10,7 @@ __PACKAGE__->asynchronous(1);
 use JSON;
 
 sub get {
-    my ( $self, $queue_name ) = @_;
-
-    my $conf = $self->application->config->{redis};
-    my $stats = { redis => $conf->{host} . ':' . $conf->{port}, };
+    my ($self, $queue_name) = @_;
 
     if ($queue_name) {
         my $key = $self->_queue($queue_name);
@@ -21,10 +18,7 @@ sub get {
             $key,
             sub {
                 my $size = shift;
-                $stats->{queue} = $queue_name;
-                $stats->{size}  = $size;
-                my $json = JSON::encode_json($stats);
-                $self->finish($json);
+                $self->entity({queue => $queue_name, size => $size});
             }
         );
     }
@@ -33,9 +27,7 @@ sub get {
             'QUEUESET',
             sub {
                 my $res = shift;
-                $stats->{queues} = $res;
-                $stats->{size}   = scalar @$res;
-                $self->finish( JSON::encode_json($stats) );
+                $self->entity({queues => $res, size => scalar @$res});
             }
         );
     }
@@ -46,10 +38,12 @@ __END__
 
 =head1 NAME
 
-presque::IndexHandler - a redis based message queue
+presque::StatusHandler - return the current size of a queue
 
 =head1 DESCRIPTION
 
+=head2 GET
+
 =head1 AUTHOR
 
 franck cuny E<lt>franck@lumberjaph.netE<gt>