Make PathInput plugin cache validity configurable
PathInput plugin keeps a cache of path evaluations. This cache is simple, and path is not checked more than once every N seconds, where N=30. The caching is there to avoid expensive calls to `nix-store --add`. This change makes the validity period configurable. The main use case is `api-test.pl` which was implemented wrong for a while, as the invocation of `hydra-eval-jobset` would return the previous evaluation, claiming there are no changes. The test has been fixed to check better for a new evaluation.
This commit is contained in:
@ -22,9 +22,11 @@ sub fetchInput {
|
||||
my $sha256;
|
||||
my $storePath;
|
||||
|
||||
my $timeout = $self->{config}->{path_input_cache_validity_seconds} // 30;
|
||||
|
||||
# Some simple caching: don't check a path more than once every N seconds.
|
||||
(my $cachedInput) = $self->{db}->resultset('CachedPathInputs')->search(
|
||||
{srcpath => $uri, lastseen => {">", $timestamp - 30}},
|
||||
{srcpath => $uri, lastseen => {">", $timestamp - $timeout}},
|
||||
{rows => 1, order_by => "lastseen DESC"});
|
||||
|
||||
if (defined $cachedInput && isValidPath($cachedInput->storepath)) {
|
||||
|
Reference in New Issue
Block a user