p5-RedisDB / RedisDB

Perl extension to access Redis
22 stars 11 forks source link

Using a password, database or connection name, when connected, places the RedisDB object in pipelined mode #13

Closed cameronpm closed 11 years ago

cameronpm commented 11 years ago

The &RedisDB::_connect method will place the connection in pipelined mode when specifying a password, database or connection name in the constructor. This is incompatible if you want to use &subscription_loop, the user either has to call &mainloop before calling the subscription loop, or some special coordination should be done inside subscription_loop so it can call mainloop if it's detected that it's just connected and no other commands have been run.

use strict; use warnings; use 5.010;
use RedisDB;

my $redis = RedisDB->new(database => 1);
# uncomment for this to work
# $redis->mainloop;
$redis->subscription_loop(subscribe => [foo => sub { shift->unsubscribe }]);
You can't start subscription loop while in pipelining mode. at redis.pl line 7
trinitum commented 11 years ago

Thanks for reporting this. I see the problem and will try to fix it this weekend.