summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eg/worker.pl1
-rw-r--r--lib/presque.pm7
-rw-r--r--lib/presque/ControlHandler.pm4
-rw-r--r--templates/index.html19
4 files changed, 27 insertions, 4 deletions
diff --git a/eg/worker.pl b/eg/worker.pl
index fc7526c..1c22bbf 100644
--- a/eg/worker.pl
+++ b/eg/worker.pl
@@ -9,6 +9,7 @@ extends 'presque::worker';
sub work {
my ($self, $job) = @_;
say "job's done";
+ ...; # yadda yadda!
return;
}
diff --git a/lib/presque.pm b/lib/presque.pm
index 370ea3a..9d88ca7 100644
--- a/lib/presque.pm
+++ b/lib/presque.pm
@@ -25,11 +25,10 @@ has redis => (
lazy => 1,
default => sub {
my $self = shift;
- my $r = AnyEvent::Redis->new(
+ AnyEvent::Redis->new(
host => $self->config->{redis}->{host},
port => $self->config->{redis}->{port}
);
- $r;
}
);
@@ -89,6 +88,10 @@ all the queues.
return some basic information about a queue.
+=item B<GET /control/queuename>
+
+=item B<POST /control/queuename>
+
=back
=head2 INSERT A JOB
diff --git a/lib/presque/ControlHandler.pm b/lib/presque/ControlHandler.pm
index 94ceab0..f900ea9 100644
--- a/lib/presque/ControlHandler.pm
+++ b/lib/presque/ControlHandler.pm
@@ -11,7 +11,7 @@ before [qw/get post/] => sub {
sub get {
my ( $self, $queue_name ) = @_;
-
+
if ( !$queue_name ) {
$self->response->code(404);
$self->finish("queue name is missing");
@@ -82,6 +82,8 @@ presque::ControlHandler - a redis based message queue
=head1 DESCRIPTION
+=head1 METHODS
+
=head1 AUTHOR
franck cuny E<lt>franck@lumberjaph.netE<gt>
diff --git a/templates/index.html b/templates/index.html
index 3d26f52..ee2c701 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -1,7 +1,24 @@
<html>
+
<head>
- <title>Presque - a redis based message queue</title>
+ <title>Presque - a redis/tatsumaki based message queue</title>
+ <script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
+ <script type="text/javascript" language="javascript">
+ $(document).ready(function() {
+ $.getJSON('/stats/', function(stats) {
+ $("#stats").append('<span>server:'+stats.redis+'</span><br />').append('<span>queues total: '+stats.size+'</span>');
+ for(i=0;i<stats.queues.length;i++) {
+ $("#queues").append('<tr><td>'+stats.queues[i]+'</td></tr>');
+ }
+ })
+ })
+ </script>
</head>
+
<body>
+ <h1>Presque - a redis/tatsumaki based message queue</h1>
+ <div id="stats"></div>
+ <ul id="queues"></ul>
</body>
+
</html>