Branch Coverage

blib/lib/cPanel/TaskQueue.pm
Criterion Covered Total %
branch 117 164 71.3


line true false branch
71 0 24 if @_ % 2
72 2 22 if $are_policies_set
73 19 3 unless @_
79 3 1 if ('-logger' eq $policy) { }
1 0 elsif ('-serializer' eq $policy) { }
96 0 1 if ref $module
97 0 1 unless $module =~ /^\w+(?:::\w+)*$/
99 0 1 if $@
100 0 1 unless _valid_serializer($module)
108 0 3 unless eval { do { $serializer->can($method) } }
114 17 13 unless (defined $the_serializer)
116 0 17 if $@
127 27 262 if &$pred()
174 2 65 unless (defined $command and length $command)
177 1 64 unless (defined $processor)
180 1 63 if (exists $valid_processors{$command})
183 50 13 if ('CODE' eq ref $processor) { }
12 1 elsif (eval { do { $processor->isa('cPanel::TaskQueue::Processor') } }) { }
198 2 3 unless (defined $command and length $command)
201 1 2 unless (exists $valid_processors{$command})
213 1 32 unless 'HASH' eq ref $args_ref
216 0 32 if exists $$args_ref{'cache_dir'}
217 1 31 unless exists $$args_ref{'state_dir'}
218 1 30 unless exists $$args_ref{'name'}
221 0 30 if (defined $$args_ref{'serial'})
246 0 30 exists $$args_ref{'state_timeout'} ? :
0 30 exists $$args_ref{'logger'} ? :
254 4 26 unless (eval { do { $$self{'disk_state'} = 'cPanel::StateFile'->new($state_args); 1 } })
258 0 4 unless $ex =~ /Not a recognized|Invalid version/
272 2 28 if (grep {exists $$args_ref{$_};} 'default_timeout', 'max_timeout', 'max_running', 'default_child_timeout')
282 8 0 if (exists $$args_ref{$arg_name} and $$self{$internal_name} ne $$args_ref{$arg_name})
287 2 0 if $altered
295 10 4 $$self{'disk_state'} ? :
300 1 0 $$self{'disk_state'} ? :
305 1 0 $$self{'disk_state'} ? :
328 2 7 unless defined $magic and $magic eq $FILETYPE
329 2 5 unless defined $version and $version eq $CACHE_VERSION
333 1 4 if $$meta{'nextid'} > $$self{'next_id'}
336 5 0 if $$meta{'def_task_to'} > 0
337 5 0 if $$meta{'max_task_to'} > 0
338 5 0 if $$meta{'max_running'} > 0
339 5 0 if $$meta{'def_child_to'} > 0
340 0 5 if exists $$meta{'paused'} and $$meta{'paused'}
341 5 0 exists $$meta{'defer_obj'} ? :
353 0 15 unless defined $task_list
357 3 0 if defined $_
367 2 170 $$self{'paused'} ? :
385 0 99 unless defined $command
387 1 98 if (eval { do { $command->isa('cPanel::TaskQueue::Task') } })
388 1 0 if (0 == $command->retries_remaining)
397 2 96 unless $command =~ /\S/
413 2 13 unless (_is_valid_uuid($uuid))
431 4 16 unless (_is_valid_uuid($uuid))
456 1 4 unless defined $task
467 2 5 unless defined $task
478 1 3 unless @tasks
502 1 6 if $$self{'paused'}
512 1 13 unless @{$$self{'queue_waiting'};}
525 0 33 if (_first sub { not defined $_; } , @{$$self{'queue_waiting'};})
538 1 32 if $$self{'paused'}
544 9 36 unless @{$$self{'queue_waiting'};}
549 1 35 unless ($processor)
558 13 22 if ($processor->is_task_deferred($task, $$self{'defer_obj'}))
583 0 17 unless (eval { do { local $SIG{'ALRM'} = sub { die "time out reached\n"; } ; $orig_alarm = alarm $self->_timeout($processor); $pid = $processor->process_task($task->clone, $$self{'disk_state'}->get_logger); alarm $orig_alarm; 1 } })
591 15 2 if ($pid) { }
603 0 17 if ($ex)
604 0 0 if ($ex eq "time out reached\n") { }
633 0 0 unless $pid
635 0 0 if $_->pid
691 1 95 unless ($proc)
694 1 94 unless ($proc->is_valid_args($task))
710 6 88 if $self->_is_duplicate_command($task)
727 0 22 $timeout > $$self{'max_task_timeout'} ? :
737 37 36 unless $num_processing
741 36 0 if @{$$self{'processing_list'};} == $num_processing
744 0 0 unless ($guard)
756 40 0 if $_->pid
763 0 22 unless $task
772 2 0 unless $task
795 36 0 if (_get_task_processor($task)->is_task_deferred($task, $$self{'defer_obj'})) { }
806 0 36 if @proc
832 0 0 if $pid < 1