From 15a5e05a38693debd944ba6e467a2f405e00b17c Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Tue, 10 Jan 2023 13:14:43 +0000 Subject: [PATCH] #957 error in job queue management when deleting one job --- Changes | 3 ++- lib/App/Netdisco/JobQueue/PostgreSQL.pm | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index c84933ea..7b017ee5 100644 --- a/Changes +++ b/Changes @@ -2,7 +2,8 @@ [BUG FIXES] - * #953 fix port reconfig (vlan) fail due to missing DB column data + * #953 port reconfig (vlan) fail due to missing DB column data + * #957 race condition in job queue management when deleting one job 2.060003 - 2022-12-14 diff --git a/lib/App/Netdisco/JobQueue/PostgreSQL.pm b/lib/App/Netdisco/JobQueue/PostgreSQL.pm index 0525d071..e9b655f6 100644 --- a/lib/App/Netdisco/JobQueue/PostgreSQL.pm +++ b/lib/App/Netdisco/JobQueue/PostgreSQL.pm @@ -385,7 +385,8 @@ sub jq_delete { if ($id) { schema(vars->{'tenant'})->txn_do(sub { - schema(vars->{'tenant'})->resultset('Admin')->find($id)->delete(); + my $job = schema(vars->{'tenant'})->resultset('Admin')->find($id); + $job->delete() if $job; }); } else {