about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiOverview.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-02-02 11:46:55 +0000
committerEric Wong <e@80x24.org>2021-02-03 07:32:39 +0000
commit37e2fd40b9d3c37b202a693f6929411bd1064eae (patch)
treee0b4c24c9a70d3057c0bd1958495c114a34d812f /lib/PublicInbox/LeiOverview.pm
parent82ec2366a5ba031267604925a70f4f3a29372d61 (diff)
downloadpublic-inbox-37e2fd40b9d3c37b202a693f6929411bd1064eae.tar.gz
Avoid on-stack shortcuts which may prevent destructors from
firing since we're not inside the event loop.  We'll also tidy
up the unlink mechanism in LeiOverview while we're at it.
Diffstat (limited to 'lib/PublicInbox/LeiOverview.pm')
-rw-r--r--lib/PublicInbox/LeiOverview.pm7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/PublicInbox/LeiOverview.pm b/lib/PublicInbox/LeiOverview.pm
index 1d62ffe2..31cc67f1 100644
--- a/lib/PublicInbox/LeiOverview.pm
+++ b/lib/PublicInbox/LeiOverview.pm
@@ -26,16 +26,15 @@ sub _iso8601 ($) { strftime('%Y-%m-%dT%H:%M:%SZ', gmtime($_[0])) }
 # we open this in the parent process before ->wq_do handoff
 sub ovv_out_lk_init ($) {
         my ($self) = @_;
-        $self->{tmp_lk_id} = "$self.$$";
         my $tmp = File::Temp->new("lei-ovv.dst.$$.lock-XXXXXX",
                                         TMPDIR => 1, UNLINK => 0);
-        $self->{lock_path} = $tmp->filename;
+        $self->{"lk_id.$self.$$"} = $self->{lock_path} = $tmp->filename;
 }
 
 sub ovv_out_lk_cancel ($) {
         my ($self) = @_;
-        ($self->{tmp_lk_id}//'') eq "$self.$$" and
-                unlink(delete($self->{lock_path}));
+        my $lock_path = delete $self->{"lk_id.$self.$$"} or return;
+        unlink($lock_path);
 }
 
 sub detect_fmt ($$) {