lib/ForgeOps/Tracker/ChangeDelivery.pm

filter: Statementstmt 57.1% 8 / 14 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 2 / 4 Podpod 0.0% 0 / 2 totaltotal 45.4% 10 / 22 CC 2 SCAR 11.6
CC
2
Cov
50%
deliver
6.0
new
2.0
BEGIN
1.0
CRAP 3.2
« lib/ForgeOps/Tracker/Client.pm ↑ Summary blib/lib/ForgeOps/Tracker/SpanDelivery.pm »
1 package ForgeOps::Tracker::ChangeDelivery;
2  
3 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # Adapts Client->deliver_change and Client->deliver_change_snapshot to the deliver() method
7 # DeliveryQueue's worker thread calls, the same way SpanDelivery does for traces, so record_change()
8 # and the startup snapshot share one queue (its bound, its lazy thread start, its per-item error
9 # guard) and never block the caller. Each queued item is [$kind, $payload], $kind being 'change' or
10 # 'snapshot': one queue and one worker thread for both, rather than a second thread (a whole
11 # interpreter clone under ithreads) for a snapshot that's only sent once.
12 10 my %METHOD_FOR = (change => 'deliver_change', snapshot => 'deliver_change_snapshot');
13  
14 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
15 0 my ($class, $client) = @_;
16 0 return bless { client => $client }, $class;
17 }
18  
19 0 ▶sub deliver {
Subroutine deliver: not called CC=2 SCAR=17.9
Pod undocumented
20 0 my ($self, $item) = @_;
21 0 my ($kind, $payload) = @$item;
22 0 ▶ my $method = $METHOD_FOR{$kind} or return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $method = $METHOD_FOR{$kind} or return 0 0 0 0
23 0 return $self->{client}->$method($payload);
24 }
25  
26 10 1;
« lib/ForgeOps/Tracker/Client.pm ↑ Summary blib/lib/ForgeOps/Tracker/SpanDelivery.pm »