@@ -756,12 +756,14 @@ sub attempt_allocation {
logm("host allocation: successful, reporting to planner.");
} else {
logm("host allocation: planned start in $best->{Start} seconds.");
+
my $maxwait = $r{hostalloc_maxwait_max};
+ my $now = time // die $!;
if (defined $maxwait) {
# We quit if:
# * we have been waiting at least $maxwait/2
# * we estimate it will take at least $maxwait overall
- my $wait_sofar = (time // die $!) - $alloc_start_time;
+ my $wait_sofar = $now - $alloc_start_time;
die "timed out: $wait_sofar, $best->{Start}, $maxwait"
if $wait_sofar > $maxwait/2
&& $wait_sofar + $best->{Start} > $maxwait;
Prep work, no functional change. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> --- ts-hosts-allocate-Executive | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)