about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-08-29 09:26:38 +0000
committerEric Wong <e@80x24.org>2022-08-29 19:05:49 +0000
commitbe55542acc90572da54d828313c2416ae1c902b1 (patch)
tree001d9a6f38a16a023bd6f6b7a32a30403442a1ca /t
parenta66a2eddda8ffbb7679f4ef80dba7c7d377cda84 (diff)
downloadpublic-inbox-be55542acc90572da54d828313c2416ae1c902b1.tar.gz
treewide: ditch inbox->recent method
It's a needless wrapper, nowadays.  Originally, ->over was added
on experimental basis to optimize for /$INBOX/ where Xapian
->search is slower on gigantic (LKML-sized) inboxes.

Nowadays with extindex, ->over is here to stay given NNTP and
IMAP both benefit from it.  So reduce the interpreter stack
overhead and just access ->over directly.

lxs->recent was never used outside of tests, anyways.

And while we're in the area, avoid needlessly bumping the
refcount of $ctx->{ibx} in View::paginate_recent.
Diffstat (limited to 't')
-rw-r--r--t/convert-compact.t2
-rw-r--r--t/indexlevels-mirror.t10
-rw-r--r--t/lei_xsearch.t2
-rw-r--r--t/replace.t4
-rw-r--r--t/v1-add-remove-add.t2
-rw-r--r--t/v2-add-remove-add.t2
6 files changed, 11 insertions, 11 deletions
diff --git a/t/convert-compact.t b/t/convert-compact.t
index 7270cab0..def09567 100644
--- a/t/convert-compact.t
+++ b/t/convert-compact.t
@@ -101,7 +101,7 @@ foreach (@xdir) {
         is($st[2] & 07777, -f _ ? 0444 : 0755,
                 'sharedRepository respected after v2 compact');
 }
-my $msgs = $ibx->recent({limit => 1000});
+my $msgs = $ibx->over->recent({limit => 1000});
 is($msgs->[0]->{mid}, 'a-mid@b', 'message exists in history');
 is(scalar @$msgs, 1, 'only one message in history');
 
diff --git a/t/indexlevels-mirror.t b/t/indexlevels-mirror.t
index ac85643d..463b35be 100644
--- a/t/indexlevels-mirror.t
+++ b/t/indexlevels-mirror.t
@@ -41,7 +41,7 @@ my $import_index_incremental = sub {
                 inboxdir => $ibx->{inboxdir},
                 indexlevel => $level
         });
-        my $msgs = $ro_master->recent;
+        my $msgs = $ro_master->over->recent;
         is(scalar(@$msgs), 1, 'only one message in master, so far');
         is($msgs->[0]->{mid}, 'm@1', 'first message in master indexed');
 
@@ -71,7 +71,7 @@ my $import_index_incremental = sub {
                 inboxdir => $mirror,
                 indexlevel => $level,
         });
-        $msgs = $ro_mirror->recent;
+        $msgs = $ro_mirror->over->recent;
         is(scalar(@$msgs), 1, 'only one message, so far');
         is($msgs->[0]->{mid}, 'm@1', 'read first message');
 
@@ -83,7 +83,7 @@ my $import_index_incremental = sub {
         # mirror updates
         is(xsys('git', "--git-dir=$fetch_dir", qw(fetch -q)), 0, 'fetch OK');
         ok(run_script([qw(-index -j0), $mirror]), "v$v index mirror again OK");
-        $msgs = $ro_mirror->recent;
+        $msgs = $ro_mirror->over->recent;
         is(scalar(@$msgs), 2, '2nd message seen in mirror');
         is_deeply([sort { $a cmp $b } map { $_->{mid} } @$msgs],
                 ['m@1','m@2'], 'got both messages in mirror');
@@ -91,7 +91,7 @@ my $import_index_incremental = sub {
         # incremental index master (required for v1)
         ok(run_script([qw(-index -j0), $ibx->{inboxdir}, "-L$level"]),
                 'index master OK');
-        $msgs = $ro_master->recent;
+        $msgs = $ro_master->over->recent;
         is(scalar(@$msgs), 2, '2nd message seen in master');
         is_deeply([sort { $a cmp $b } map { $_->{mid} } @$msgs],
                 ['m@1','m@2'], 'got both messages in master');
@@ -120,7 +120,7 @@ my $import_index_incremental = sub {
         # sync the mirror
         is(xsys('git', "--git-dir=$fetch_dir", qw(fetch -q)), 0, 'fetch OK');
         ok(run_script([qw(-index -j0), $mirror]), "v$v index mirror again OK");
-        $msgs = $ro_mirror->recent;
+        $msgs = $ro_mirror->over->recent;
         is(scalar(@$msgs), 1, '2nd message gone from mirror');
         is_deeply([map { $_->{mid} } @$msgs], ['m@1'],
                 'message unavailable in mirror');
diff --git a/t/lei_xsearch.t b/t/lei_xsearch.t
index d9ddb297..fabceb41 100644
--- a/t/lei_xsearch.t
+++ b/t/lei_xsearch.t
@@ -61,7 +61,7 @@ for my $mi ($mset->items) {
 }
 is(scalar(@msgs), $nr, 'smsgs retrieved for all');
 
-$mset = $lxs->recent(undef, { limit => 1 });
+$mset = $lxs->mset('z:1..', { relevance => -2, limit => 1 });
 is($mset->size, 1, 'one result');
 
 my @ibxish = $lxs->locals;
diff --git a/t/replace.t b/t/replace.t
index 626cbe9b..0e121399 100644
--- a/t/replace.t
+++ b/t/replace.t
@@ -49,7 +49,7 @@ EOF
         $im->done;
         my $thread_a = $ibx->over->get_thread('replace@example.com');
 
-        my %before = map {; delete($_->{blob}) => $_ } @{$ibx->recent};
+        my %before = map {; delete($_->{blob}) => $_ } @{$ibx->over->recent};
         my $reject = PublicInbox::Eml->new($orig->as_string);
         foreach my $mid (['<replace@example.com>', '<extra@example.com>'],
                                 [], ['<replaced@example.com>']) {
@@ -126,7 +126,7 @@ EOF
         }
 
         # check overview matches:
-        my %after = map {; delete($_->{blob}) => $_ } @{$ibx->recent};
+        my %after = map {; delete($_->{blob}) => $_ } @{$ibx->over->recent};
         my @before_blobs = keys %before;
         foreach my $blob (@before_blobs) {
                 delete $before{$blob} if delete $after{$blob};
diff --git a/t/v1-add-remove-add.t b/t/v1-add-remove-add.t
index a94bf7fd..ae045dfa 100644
--- a/t/v1-add-remove-add.t
+++ b/t/v1-add-remove-add.t
@@ -32,7 +32,7 @@ ok($im->add($mime), 'message added again');
 $im->done;
 my $rw = PublicInbox::SearchIdx->new($ibx, 1);
 $rw->index_sync;
-my $msgs = $ibx->recent({limit => 10});
+my $msgs = $ibx->over->recent({limit => 10});
 is($msgs->[0]->{mid}, 'a-mid@b', 'message exists in history');
 is(scalar @$msgs, 1, 'only one message in history');
 is($ibx->mm->num_for('a-mid@b'), 2, 'exists with second article number');
diff --git a/t/v2-add-remove-add.t b/t/v2-add-remove-add.t
index 579cdcb6..6affc830 100644
--- a/t/v2-add-remove-add.t
+++ b/t/v2-add-remove-add.t
@@ -32,7 +32,7 @@ ok($im->add($mime), 'message added');
 ok($im->remove($mime), 'message removed');
 ok($im->add($mime), 'message added again');
 $im->done;
-my $msgs = $ibx->recent({limit => 1000});
+my $msgs = $ibx->over->recent({limit => 1000});
 is($msgs->[0]->{mid}, 'a-mid@b', 'message exists in history');
 is(scalar @$msgs, 1, 'only one message in history');