diff mbox series

[OSSTEST,16/21] ts-host-allocate-Executive: Break out $now and add a newline

Message ID 20190418163158.11408-17-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show
Series Abandon jobs which are unreasonably delaying their flight | expand

Commit Message

Ian Jackson April 18, 2019, 4:31 p.m. UTC
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(-)
diff mbox series

Patch

diff --git a/ts-hosts-allocate-Executive b/ts-hosts-allocate-Executive
index 3da138b1..3425c8ce 100755
--- a/ts-hosts-allocate-Executive
+++ b/ts-hosts-allocate-Executive
@@ -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;