diff options
author | Eric Wong <e@80x24.org> | 2021-04-03 02:24:23 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-04-03 05:08:52 +0000 |
commit | 39b7af9565f85a720e7eeb7564cfa661000cb7e9 (patch) | |
tree | 239ebb2145efc2d8ad34f550675ff2e35b341550 /lib/PublicInbox/LeiAuth.pm | |
parent | 385bdbda71172fc421fc4cb6018270566f3268c9 (diff) | |
download | public-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.pm | 15 |
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 |