Allow PathInput to take an optional frequency parameter.
The previous version hard-coded the cache check frequency to 30 seconds. This meant that the path was checked very frequently (max of 30 seconds and the evaluation period of the job), which could be problematic for URL PathInput specifications, and especially ones that are automatically updated frequently without *each* update necessarily being interesting (an example: the haskell hackage index file.)
This commit is contained in:
@@ -11,12 +11,22 @@ sub supportedInputTypes {
|
||||
$inputTypes->{'path'} = 'Local path';
|
||||
}
|
||||
|
||||
sub _parseValue {
|
||||
my ($value) = @_;
|
||||
my @parts = split ' ', $value;
|
||||
(my $uri, my $freq) = @parts;
|
||||
# by default don't check a path more often than every 30 seconds,
|
||||
# but the second path argument can change that value.
|
||||
$freq = defined $freq ? $freq : 30;
|
||||
return ($uri, $freq);
|
||||
}
|
||||
|
||||
sub fetchInput {
|
||||
my ($self, $type, $name, $value) = @_;
|
||||
|
||||
return undef if $type ne "path";
|
||||
|
||||
my $uri = $value;
|
||||
my ($uri, $timeout) = _parseValue($value);
|
||||
|
||||
my $timestamp = time;
|
||||
my $sha256;
|
||||
|
||||
Reference in New Issue
Block a user