* [PATCH 1/2] t/thread-cycle: make Email::Simple optional
2021-10-04 0:07 6% ` [PATCH 0/2] www: fix ref cycles when threading extindex Eric Wong
@ 2021-10-04 0:07 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-10-04 0:07 UTC (permalink / raw)
To: meta
We only use it if Mail::Thread is available, and often it's not.
---
t/thread-cycle.t | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/t/thread-cycle.t b/t/thread-cycle.t
index 613c142e65cd..4b47c01c37c1 100644
--- a/t/thread-cycle.t
+++ b/t/thread-cycle.t
@@ -1,19 +1,16 @@
# Copyright (C) 2016-2021 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
-use strict;
-use warnings;
-use Test::More;
-use PublicInbox::TestCommon;
-require_mods 'Email::Simple';
+use strict; use v5.10.1; use PublicInbox::TestCommon;
use_ok('PublicInbox::SearchThread');
my $mt = eval {
require Mail::Thread;
no warnings 'once';
$Mail::Thread::nosubject = 1;
$Mail::Thread::noprune = 1;
+ require Email::Simple; # required by Mail::Thread (via Email::Abstract)
};
-sub make_objs {
+my $make_objs = sub {
my @simples;
my $n = 0;
my @msgs = map {
@@ -21,17 +18,19 @@ sub make_objs {
$msg->{ds} ||= ++$n;
$msg->{references} =~ s/\s+/ /sg if $msg->{references};
$msg->{blob} = '0'x40; # any dummy value will do, here
- my $simple = Email::Simple->create(header => [
- 'Message-ID' => "<$msg->{mid}>",
- 'References' => $msg->{references},
- ]);
- push @simples, $simple;
+ if ($mt) {
+ my $simple = Email::Simple->create(header => [
+ 'Message-ID' => "<$msg->{mid}>",
+ 'References' => $msg->{references},
+ ]);
+ push @simples, $simple;
+ }
bless $msg, 'PublicInbox::Smsg'
} @_;
(\@simples, \@msgs);
-}
+};
-my ($simples, $smsgs) = make_objs(
+my ($simples, $smsgs) = $make_objs->(
# data from t/testbox-6 in Mail::Thread 2.55:
{ mid => '20021124145312.GA1759@nlin.net' },
{ mid => 'slrnau448m.7l4.markj+0111@cloaked.freeserve.co.uk',
@@ -79,13 +78,13 @@ my @backwards = (
{ mid => 8, references => '' }
);
-($simples, $smsgs) = make_objs(@backwards);
+($simples, $smsgs) = $make_objs->(@backwards);
my $backward = thread_to_s($smsgs);
SKIP: {
skip 'Mail::Thread missing', 1 unless $mt;
check_mt($backward, $simples, 'matches Mail::Thread backwards');
}
-($simples, $smsgs) = make_objs(reverse @backwards);
+($simples, $smsgs) = $make_objs->(reverse @backwards);
my $forward = thread_to_s($smsgs);
unless ('Mail::Thread sorts by Date') {
SKIP: {
^ permalink raw reply related [relevance 7%]
* [PATCH 0/2] www: fix ref cycles when threading extindex
@ 2021-10-04 0:07 6% ` Eric Wong
2021-10-04 0:07 7% ` [PATCH 1/2] t/thread-cycle: make Email::Simple optional Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-10-04 0:07 UTC (permalink / raw)
To: meta
I finally got Devel::Mwrap::PSGI working and fixed a
long-standing reference cycle. AFAIK, it only affects
extindex users, not v2, and definitely not v1.
Eric Wong (2):
t/thread-cycle: make Email::Simple optional
www: fix ref cycle from threading w/ extindex
lib/PublicInbox/SearchThread.pm | 104 +++++++++++++++++---------------
t/thread-cycle.t | 50 ++++++++++-----
2 files changed, 88 insertions(+), 66 deletions(-)
^ permalink raw reply [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-09-04 23:53 httpd memory usage? Eric Wong
2021-10-04 0:07 6% ` [PATCH 0/2] www: fix ref cycles when threading extindex Eric Wong
2021-10-04 0:07 7% ` [PATCH 1/2] t/thread-cycle: make Email::Simple optional Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).