add option to disable max_deferrals

This commit is contained in:
Oliver Gorwits
2017-05-28 09:31:57 +01:00
parent 666e0a593d
commit 9ac2662182
2 changed files with 5 additions and 3 deletions

View File

@@ -18,16 +18,17 @@ Retuns a correlated subquery for the set of C<device_skip> entries that apply
to some jobs. They match the device IP, current backend, and job action.
Pass the C<backend> FQDN (or the current host will be used as a default), and
the C<max_deferrals> (or 10 will be used as the default).
the C<max_deferrals> (option disabled if 0/undef value is passed).
=cut
sub skipped {
my ($rs, $backend, $max_deferrals) = @_;
$backend ||= (hostfqdn || 'localhost');
$max_deferrals ||= 10;
$max_deferrals ||= 10_000_000; # not really 'disabled'
return $rs->correlate('device_skips')->search(undef, {
# NOTE: bind param list order is significant
bind => [[deferrals => $max_deferrals], [backend => $backend]],
});
}