about summary refs log tree commit diff
path: root/lib/presque/RestQueueBatchHandler.pm
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-07-01 09:31:58 +0200
committerfranck cuny <franck@lumberjaph.net>2010-07-01 09:31:58 +0200
commit2b0e4e2250d24bc93ac91d9e799d448cca20aa51 (patch)
tree0483a93b89cdd31364964d8c9bb824a75c9bee54 /lib/presque/RestQueueBatchHandler.pm
parentfrom a method (diff)
downloadpresque-2b0e4e2250d24bc93ac91d9e799d448cca20aa51.tar.gz
update on stats
Diffstat (limited to 'lib/presque/RestQueueBatchHandler.pm')
-rw-r--r--lib/presque/RestQueueBatchHandler.pm15
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/presque/RestQueueBatchHandler.pm b/lib/presque/RestQueueBatchHandler.pm
index 281b117..ef37045 100644
--- a/lib/presque/RestQueueBatchHandler.pm
+++ b/lib/presque/RestQueueBatchHandler.pm
@@ -89,8 +89,8 @@ sub _get_jobs_from_queue {
 sub _update_queue_stats {
     my ($self, $queue_name, $jobs) = @_;
 
-    $self->application->redis->incrby('processed', scalar @$jobs);
-    $self->application->redis->incrby($self->_queue_processed($queue_name), scalar @$jobs);
+    $self->application->redis->hincrby($self->_queue_processed, $queue_name,
+        scalar @$jobs);
 }
 
 sub _update_worker_stats {
@@ -100,15 +100,8 @@ sub _update_worker_stats {
     my $worker_id = $input->{worker_id};
 
     if ($worker_id) {
-        $self->application->redis->set(
-            $self->_queue_worker($worker_id),
-            JSON::encode_json(
-                {   queue  => $queue_name,
-                    run_at => time()
-                }
-            )
-        );
-        $self->application->redis->incrby('processed:' . $worker_id, scalar @$jobs);
+        $self->application->redis->hincrby($self->_workers_processed,
+            $worker_id, @$jobs);
     }
 }