Namespacing is not compatible with Ruby
jari-omniata opened this issue · 0 comments
jari-omniata commented
My Ruby-code displaying statistics:
Resque.queues.each do |queue|
puts "Queue #{queue}: #{Resque.size(queue)}"
end
Displays weird names if using namespaces.
Fix:
--- Resque.pm.orig 2014-10-27 11:55:38.000000000 +0000
+++ Resque.pm 2014-10-27 11:58:03.000000000 +0000
@@ -152,7 +152,11 @@
my ($self, $name) = @_;
$self->{watched_queues} ||= {};
$self->{watched_queues}{$name} = 1;
- $self->redis->sadd($self->key("queues"), $self->queue($name));
+
+ # Eat out the namespace from the queue name to make namespacing work with Ruby-code
+ my $queue_name = $self->queue($name);
+ $queue_name =~ s/^.+://;
+ $self->redis->sadd($self->key("queues"), $queue_name);
}