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.
@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';
$packet->install;
};
- # sending a report uses the key index
- keyidx_attach;
-
if ($packet->successful) {
local $Phase = 'RP';