From 6d69ba64f289dba700778fe4df2146ef5d7dbb2e Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Fri, 4 Aug 2023 17:17:56 -0500 Subject: [PATCH] Ensure key index is ready before processing first packet The key index is never detached, so all packets after the first were always processed with the index lock held. Further, the index is needed to send a report, so ensuring that it is available before processing the first packet avoids a potential lost report if it cannot be attached. --- gatekeeper.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gatekeeper.pl b/gatekeeper.pl index cceb210..79db0d9 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -3367,6 +3367,9 @@ my @packets; @packets = gather_packets(CONF_DIR_Inbox, CONF_DIR_Scratch); } +# sending a report uses the key index +keyidx_attach if @packets; + foreach my $packet (@packets) { eval { # trap exceptions encountered while processing a packet local $Phase = 'PS'; @@ -3383,9 +3386,6 @@ foreach my $packet (@packets) { $packet->install; }; - # sending a report uses the key index - keyidx_attach; - if ($packet->successful) { local $Phase = 'RP'; -- 2.25.1