Ensure key index is ready before processing first packet
authorJacob Bachmeyer <jcb@gnu.org>
Fri, 4 Aug 2023 22:17:56 +0000 (17:17 -0500)
committerJacob Bachmeyer <jcb@gnu.org>
Fri, 4 Aug 2023 22:17:56 +0000 (17:17 -0500)
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

index cceb21055a2591c5dd7c513e13655904bd7a7e1c..79db0d920e661ceb4d68c05f5cfc15fe26137fca 100755 (executable)
@@ -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';