Branch Coverage

blib/lib/Async/Redis.pm
Criterion Covered Total %
branch 23 282 8.1


line true false branch
52 0 75 unless eval { do { require Protocol::Redis::XS; 1 } }
57 0 0 $INC{'Protocol/Redis/XS.pm'} ? :
67 0 0 if $delay > $self->{'reconnect_delay_max'}
70 0 0 if ($self->{'reconnect_jitter'} > 0)
83 2 82 if ($args{'uri'})
86 2 0 if ($uri)
165 4 80 $args{'path'} ? :
4 80 $args{'path'} ? :
169 0 84 if ($self->{'debug'} or $self->{'otel_tracer'} or $self->{'otel_meter'})
189 0 77 if $self->{'connected'}
194 1 76 if ($self->{'path'}) { }
199 0 1 unless socket $socket, 1, 1, 0
211 0 76 unless $socket = "IO::Socket::INET"->new("Proto", "tcp", "Blocking", 0)
219 0 76 unless my $addr = inet_aton($self->{'host'})
242 77 0 if ($completed_f->is_failed)
247 0 77 if ($error eq "connect_timeout")
261 0 0 if ($self->{'tls'})
265 0 0 if ($@)
284 0 0 if ($self->{'auto_pipeline'})
292 0 0 if ($self->{'on_connect'})
298 0 0 if ($self->{'_telemetry'})
316 0 0 if ($self->{'password'})
318 0 0 if $self->{'username'}
328 0 0 unless ($result and $result eq "OK")
337 0 0 if ($self->{'database'} and $self->{'database'} != 0)
344 0 0 unless ($result and $result eq "OK")
353 0 0 if ($self->{'client_name'})
365 0 0 $self->{'connected'} ? :
378 0 0 if ($self->{'_subscription'} and not $self->{'_subscription'}->is_closed)
384 0 0 if ($self->{'_current_read_future'} and not $self->{'_current_read_future'}->is_ready)
390 0 0 if (my $inflight = $self->{'inflight'})
392 0 0 if ($entry->{'future'} and not $entry->{'future'}->is_ready)
399 0 0 if ($self->{'socket'})
406 0 0 if ($was_connected and $self->{'on_disconnect'})
411 0 0 if ($was_connected and $self->{'_telemetry'})
423 0 84 if ($self->{'socket'} and fileno $self->{'socket'})
433 0 0 unless my $socket = delete $self->{'socket'}
439 0 0 if (my $inflight = delete $self->{'inflight'})
441 0 0 if ($entry->{'future'} and not $entry->{'future'}->is_ready)
449 0 0 if defined $fileno
461 0 0 if ($self->{'_pid'} and $self->{'_pid'} != $$)
475 0 0 if ($self->{'_telemetry'})
493 0 0 if utf8::is_utf8($bytes)
529 0 0 if ($entry->{'future'} and not $entry->{'future'}->is_ready)
541 0 0 if $self->{'_reading_responses'}
558 0 0 unless ($read_ok)
577 0 0 if (not $decode_ok) { }
580 0 0 unless $entry->{'future'}->is_ready
583 0 0 unless $entry->{'future'}->is_ready
596 0 0 if (my $msg = $self->{'parser'}->get_message)
605 0 0 if (not defined $buf or length $buf == 0)
611 0 0 if (my $msg = $self->{'parser'}->get_message)
624 0 0 if ($cmd =~ /^(BLPOP|BRPOP|BLMOVE|BRPOPLPUSH|BLMPOP|BZPOPMIN|BZPOPMAX|BZMPOP)$/u)
630 0 0 if ($cmd =~ /^(XREAD|XREADGROUP)$/u)
633 0 0 if (uc $args[$i] eq "BLOCK")
655 0 0 if (ref $self->{'tls'} eq 'HASH') { }
656 0 0 if $self->{'tls'}{'ca_file'}
657 0 0 if $self->{'tls'}{'cert_file'}
658 0 0 if $self->{'tls'}{'key_file'}
660 0 0 if (exists $self->{'tls'}{'verify'}) { }
662 0 0 $self->{'tls'}{'verify'} ? :
677 0 0 unless "IO::Socket::SSL"->start_SSL($socket, %ssl_opts)
684 0 0 if (&Time::HiRes::time() >= $deadline)
694 0 0 if ($rv)
701 0 0 if $remaining <= 0
703 0 0 if ($IO::Socket::SSL::SSL_ERROR == IO::Socket::SSL::SSL_ERROR_WANT_READ()) { }
0 0 elsif ($IO::Socket::SSL::SSL_ERROR == IO::Socket::SSL::SSL_ERROR_WANT_WRITE()) { }
713 0 0 if ($wait_f->is_failed)
730 0 0 if ($wait_f->is_failed)
760 0 0 if ($@)
764 0 0 if ($self->{'on_error'})
779 0 0 unless my $sub = $self->{'_subscription'}
818 0 0 if ($self->{'in_pubsub'})
820 0 0 unless ($ucmd =~ /^(SUBSCRIBE|UNSUBSCRIBE|PSUBSCRIBE|PUNSUBSCRIBE|SSUBSCRIBE|SUNSUBSCRIBE|PING|QUIT)$/u)
828 0 0 if (defined $self->{'prefix'} and $self->{'prefix'} ne "")
835 0 0 if ($self->{'_auto_pipeline'})
840 0 0 if (not $self->{'connected'} and $self->{'reconnect'})
846 0 0 unless $self->{'connected'}
851 0 0 if ($self->{'_telemetry'})
875 0 0 if (not $send_ok) { }
879 0 0 unless $response_future->is_ready
890 0 0 unless ($await_ok)
896 0 0 if ($self->{'_telemetry'})
898 0 0 if ($error) { }
907 0 0 if $error
916 0 0 if (my $msg = $self->{'parser'}->get_message)
924 0 0 if ($remaining <= 0)
951 0 0 if ($read_f->is_cancelled)
957 0 0 if ($wait_f->is_failed)
959 0 0 if ($error eq "read_timeout")
978 0 0 if (not defined $buf or length $buf == 0)
987 0 0 if (my $msg = $self->{'parser'}->get_message)
1002 0 1 if ($self->{'_current_read_future'} and not $self->{'_current_read_future'}->is_ready)
1008 1 0 if (my $inflight = $self->{'inflight'})
1010 0 0 if ($entry->{'future'} and not $entry->{'future'}->is_ready)
1017 0 1 if ($self->{'socket'})
1026 0 1 if ($was_connected and $self->{'on_disconnect'})
1035 0 0 unless $msg
1041 0 0 if ($type eq '+') { }
0 0 elsif ($type eq '-') { }
0 0 elsif ($type eq ':') { }
0 0 elsif ($type eq '$') { }
0 0 elsif ($type eq '*') { }
1058 0 0 unless defined $data
1077 0 0 if exists $opts{'ex'}
1078 0 0 if exists $opts{'px'}
1079 0 0 if $opts{'nx'}
1080 0 0 if $opts{'xx'}
1146 0 0 if $mode
1164 0 0 if ($@)
1168 0 0 if ("$error" =~ /NOSCRIPT/iu) { }
1194 0 0 unless defined $name and length $name
1195 0 0 unless ref $def eq "HASH"
1196 0 0 unless defined $def->{'lua'}
1199 0 0 unless $name =~ /^[a-zA-Z_][a-zA-Z0-9_]*$/u
1213 0 0 if ($def->{'install'})
1226 0 0 unless my $script = $self->{'_scripts'}{$name}
1232 0 0 if ($num_keys eq "dynamic")
1234 0 0 unless defined $num_keys
1261 0 0 unless @names
1344 0 0 if $self->{'in_multi'}
1361 0 0 if ($collect_error)
1367 0 0 unless (@commands)
1399 0 0 if ($error)
1418 0 0 if $self->{'in_multi'}
1419 0 0 if $self->{'watching'}
1420 0 0 if $self->{'in_pubsub'}
1421 0 0 if @{$self->{'inflight'} // [];} > 0
1482 0 0 unless (@commands)
1505 0 0 if ($error)
1523 0 0 unless @{$self->{'inflight'};}
1531 0 0 if (@{$self->{'inflight'};})
1552 0 0 unless $self->{'connected'}
1581 0 0 unless $self->{'connected'}
1606 0 0 unless $self->{'connected'}
1631 1 0 unless $self->{'connected'}
1672 0 0 unless $self->{'connected'}
1674 0 0 unless @$commands
1704 0 0 if ($@)
1718 0 0 unless ($ok)
1723 0 0 if ($self->{'_telemetry'})