about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiAuth.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-04-03 02:24:23 +0000
committerEric Wong <e@80x24.org>2021-04-03 05:08:52 +0000
commit39b7af9565f85a720e7eeb7564cfa661000cb7e9 (patch)
tree239ebb2145efc2d8ad34f550675ff2e35b341550 /lib/PublicInbox/LeiAuth.pm
parent385bdbda71172fc421fc4cb6018270566f3268c9 (diff)
downloadpublic-inbox-39b7af9565f85a720e7eeb7564cfa661000cb7e9.tar.gz
Leaving workers running on after auth failures is bad and messy,
cleanup our process management to have consistent worker
teardowns.  Improve error reporting, too, instead of letting
Mail::IMAPClient->exists fail due to undef.
Diffstat (limited to 'lib/PublicInbox/LeiAuth.pm')
-rw-r--r--lib/PublicInbox/LeiAuth.pm15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/PublicInbox/LeiAuth.pm b/lib/PublicInbox/LeiAuth.pm
index 927fe550..48deca93 100644
--- a/lib/PublicInbox/LeiAuth.pm
+++ b/lib/PublicInbox/LeiAuth.pm
@@ -13,12 +13,15 @@ sub do_auth_atfork { # used by IPC WQ workers
         return if $wq->{-wq_worker_nr} != 0;
         my $lei = $wq->{lei};
         my $net = $lei->{net};
-        my $mics = $net->imap_common_init($lei);
-        my $nn = $net->nntp_common_init($lei);
-        pkt_do($lei->{pkt_op_p}, 'net_merge', $net) or
-                        die "pkt_do net_merge: $!";
-        $net->{mics_cached} = $mics if $mics;
-        $net->{nn_cached} = $nn if $nn;
+        eval {
+                my $mics = $net->imap_common_init($lei);
+                my $nn = $net->nntp_common_init($lei);
+                pkt_do($lei->{pkt_op_p}, 'net_merge', $net) or
+                                die "pkt_do net_merge: $!";
+                $net->{mics_cached} = $mics if $mics;
+                $net->{nn_cached} = $nn if $nn;
+        };
+        $lei->fail($@) if $@;
 }
 
 sub net_merge_done1 { # bump merge-count in top-level lei-daemon