We look at our own branch to estimate durations. If somehow we are
one of multiple concurrent flights on this branch with the appropriate
blessing, we don't mind not noticing the doing of our peer flights so
that if our estimates are a bit out of date.
So it is fine to use an estimate no older than our own runtime.
Right now we generate a new duration estimator during each queueing
round, because it contains a statement handle and we must disconnect
from the db while waiting. So the internal memo table gets thrown
away each time and is useless.
To actually memoise, pass our own hash which lives as long as we do.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
return sub {
my ($job, $hostidname, $onhost, $uptoincl_testid) = @_;
- my $memokey = "$job $hostidname $onhost $uptoincl_testid";
+ my $memokey = "$job $hostidname $onhost ".($uptoincl_testid//"");
my $memo = $our_memo->{$memokey};
return @$memo if $memo;
AND hostflag LIKE 'equiv-%'
END
+ our %duration_memo;
$duration_estimator= duration_estimator($fi->{branch}, $blessing,
- sub { print DEBUG "@_\n"; });
+ sub { print DEBUG "@_\n"; },
+ 0, \%duration_memo);
$resprop_q= $dbh_tests->prepare(<<END);
SELECT * FROM resource_properties