@@ -12,19 +12,31 @@ sub supportedInputTypes {
1212 $inputTypes -> {' path' } = ' Local path or URL' ;
1313}
1414
15+ sub _parseValue {
16+ # The input is a local path or URL, optionally followed by a
17+ # time period specified in seconds.
18+ my ($config , $value ) = @_ ;
19+ my @parts = split ' ' , $value ;
20+ (my $uri , my $freq ) = @parts ;
21+ # By default don't check a path more often than every 30 seconds,
22+ # but the second path argument can change that value or the global
23+ # path_input_cache_validity_seconds configuration, in that order.
24+ my $timeout = defined $freq ? $freq : ($config -> {path_input_cache_validity_seconds } // 30);
25+
26+ return ($uri , $timeout );
27+ }
28+
1529sub fetchInput {
1630 my ($self , $type , $name , $value ) = @_ ;
1731
1832 return undef if $type ne " path" ;
1933
20- my $uri = $ value ;
34+ my ( $uri , $timeout ) = _parseValue( $self -> { config }, $ value) ;
2135
2236 my $timestamp = time ;
2337 my $sha256 ;
2438 my $storePath ;
2539
26- my $timeout = $self -> {config }-> {path_input_cache_validity_seconds } // 30;
27-
2840 # Some simple caching: don't check a path more than once every N seconds.
2941 (my $cachedInput ) = $self -> {db }-> resultset(' CachedPathInputs' )-> search(
3042 {srcpath => $uri , lastseen => {" >" , $timestamp - $timeout }},
0 commit comments