From 97caa1fe259cd6904573f36e0ac078a269b6ec5f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 23 Mar 2021 11:48:08 +0000 Subject: lei: improve management around short-lived workers Instead of creating a short-lived circular reference, ensure they don't exist in the first place. Note the following changes to hold an extra ref to $sto: - $self->_lei_store(1)->write_prepare($self); + my $sto = $self->_lei_store(1); + $sto->write_prepare($self); I'm not a perlguts expert, but I actually wanted to switch to the one-line version for LeiImport, but xt/lei-auth-fail.t was getting stuck for some reason. It seems the extra ref to the LeiStore ($sto) object is necessary. --- lib/PublicInbox/LeiMark.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/PublicInbox/LeiMark.pm') diff --git a/lib/PublicInbox/LeiMark.pm b/lib/PublicInbox/LeiMark.pm index 3b5e6c2c..9d77f4b4 100644 --- a/lib/PublicInbox/LeiMark.pm +++ b/lib/PublicInbox/LeiMark.pm @@ -105,8 +105,8 @@ sub input_net_cb { # imap_each, nntp_each cb sub lei_mark { # the "lei mark" method my ($lei, @argv) = @_; my $sto = $lei->_lei_store(1); - my $self = $lei->{mark} = bless { missing => 0 }, __PACKAGE__; $sto->write_prepare($lei); + my $self = bless { missing => 0 }, __PACKAGE__; $lei->ale; # refresh and prepare my $vmd_mod = vmd_mod_extract(\@argv); return $lei->fail(join("\n", @{$vmd_mod->{err}})) if $vmd_mod->{err}; -- cgit v1.2.3-24-ge0c7