| 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
| |||||||||||
| 23 | 0 | return $self->{client}->$method($payload); | |||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 10 | 1; | |||||||||