You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is needed to have such an notification, when the subscription succeeds, and only then publish events (to be caught by subscriber).
The following test demonstrates the issue:
use strict;
use AnyEvent;
use Test::More;
use t::Redis;
test_redis {
my $sub = shift;
my $port = shift;
my $info = $sub->info->recv;
if($info->{redis_version} lt "1.3.10") {
plan skip_all => "No PUBLISH/SUBSCRIBE support in this Redis version";
}
my $sub = AnyEvent::Redis->new(host => "127.0.0.1", port => $port);
# umcomment the following to let the test pass
# $sub->ping->recv;
my $pub = AnyEvent::Redis->new(host => "127.0.0.1", port => $port);
my $cv = AnyEvent->condvar;
$sub->subscribe("test", sub {
my($message, $chan) = @_;
$cv->send(1);
});
$pub->publish("test", "test")->recv;
my $guard = AnyEvent->timer(after => 5, cb => sub { $cv->send(0); });
ok $cv->recv, "got published message";
done_testing;
};
The test passed and fails time-to-time. If ping will be uncommented it will always succeed. But pingin isn't elegant solution.
Thanks.
The text was updated successfully, but these errors were encountered:
It is needed to have such an notification, when the subscription succeeds, and only then publish events (to be caught by subscriber).
The following test demonstrates the issue:
The test passed and fails time-to-time. If ping will be uncommented it will always succeed. But pingin isn't elegant solution.
Thanks.
The text was updated successfully, but these errors were encountered: