CC: | mgrimm [...] gci.com |
Subject: | Used and watched tubes not tracked correctly after use(), watch(), and ignore() |
I'm using Perl 5.8.8 on RHEL 5.6 (Linux 2.6.18-238.12.1.el5). This
report is for AnyEvent::Beanstalk version 1.110490, but may apply to
previous versions as well (I didn't check).
The callbacks for use(), watch(), and ignore() do not correctly check
for success, and therefore do not update the internal __using and
__watching variables. As a result, using() and watching() are always
wrong, and reconnect() doesn't restore the previous state as advertised.
A related issue is that the socket check in watching() has a typo, and
always returns false. The attached patch addresses this as well, since I
use watching() to test if the __watching variable is correct.
Subject: | watching.t |
#!perl
use Test::More;
use AnyEvent::Beanstalk;
do 't/start_server.pl';
our $port;
my $c = AnyEvent::Beanstalk->new(server => "127.0.0.1:$port");
plan tests => 2;
$c->watch('foo')->recv();
ok(grep { $_ eq 'foo' } $c->watching());
$c->ignore('default')->recv();
ok(!grep { $_ eq 'default' } $c->watching());
done_testing;
Subject: | using.t |
#!perl
use Test::More;
use AnyEvent::Beanstalk;
do 't/start_server.pl';
our $port;
my $c = AnyEvent::Beanstalk->new(server => "127.0.0.1:$port");
plan tests => 1;
$c->use('foo')->recv();
is($c->using(), 'foo');
done_testing;
Subject: | reconnect.t |
#!perl
use AnyEvent::Beanstalk;
use Test::More;
do 't/start_server.pl';
our $port;
my $c = AnyEvent::Beanstalk->new(server => "127.0.0.1:$port");
plan tests => 2;
$c->use('foo')->recv;
$c->watch('bar')->recv;
$c->reconnect();
is($c->using(), 'foo');
ok(grep { $_ eq 'bar' } $c->watching());
done_testing;
Subject: | Beanstalk.pm.use-watch-ignore-patch |
Message body not shown because it is not plain text.