From f192a89a85ce6c564370750042cc18bc54c518b6 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 21 Oct 2020 15:54:20 +0100 Subject: [PATCH] share in jobdb: Break out $checkconstraints and move call This must happen after we introduce our new row or it is not effective! Signed-off-by: Ian Jackson --- Osstest/JobDB/Executive.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Osstest/JobDB/Executive.pm b/Osstest/JobDB/Executive.pm index f69ce27..071f31f 100644 --- a/Osstest/JobDB/Executive.pm +++ b/Osstest/JobDB/Executive.pm @@ -582,6 +582,11 @@ END VALUES (?, ?, ?, ?, ?, ?, ? ) END + my $checkconstraints = sub { + $constraintsq->execute($hostname, $ttaskid); + $constraintsq->fetchrow_array() or confess "$hostname ?"; + }; + my $ojvn = "$ho->{Ident}_lifecycle"; if (length $r{$ojvn}) { @@ -654,8 +659,6 @@ END push @lifecycle, "$omarks$otj:$o->{stepno}$osuffix"; } } - $constraintsq->execute($hostname, $ttaskid); - $constraintsq->fetchrow_array() or confess "$hostname ?"; if (defined $flight) { $insertq->execute($hostname, $ttaskid, @@ -670,6 +673,7 @@ END undef, undef,undef); } + $checkconstraints->(); }); if (defined $flight) { -- 2.39.5