about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-06-10 07:05:12 +0000
committerEric Wong <e@yhbt.net>2020-06-13 07:55:45 +0000
commitd0dcab33e0b02bf3299deea40f96ef5fff10fe73 (patch)
tree2c0343463544400798fb73e7567978cb83af116b /t
parent56e4554469fb86c2cac63d9eabaffa64c531e835 (diff)
downloadpublic-inbox-d0dcab33e0b02bf3299deea40f96ef5fff10fe73.tar.gz
We can get exact values for EXISTS, UIDNEXT using SQLite
rather than calculating off $ibx->mm->max ourselves.

Furthermore, $ibx->mm is less useful than $ibx->over for IMAP
(and for our read-only daemons in general) so do not depend on
$ibx->mm outside of startup/reload to save FDs and reduce kernel
page cache footprint.
Diffstat (limited to 't')
-rw-r--r--t/over.t3
1 files changed, 3 insertions, 0 deletions
diff --git a/t/over.t b/t/over.t
index 5586aa31..734fdaa3 100644
--- a/t/over.t
+++ b/t/over.t
@@ -10,6 +10,8 @@ use_ok 'PublicInbox::OverIdx';
 my ($tmpdir, $for_destroy) = tmpdir();
 my $over = PublicInbox::OverIdx->new("$tmpdir/over.sqlite3");
 $over->connect;
+is($over->max, 0, 'max is zero on new DB (scalar context)');
+is_deeply([$over->max], [0], 'max is zero on new DB (list context)');
 my $x = $over->next_tid;
 is(int($x), $x, 'integer tid');
 my $y = $over->next_tid;
@@ -58,6 +60,7 @@ foreach my $mid (qw(a b)) {
         my $msgs = [ map { $_->{num} } @{$over->get_thread($mid)} ];
         is_deeply([98, 99], $msgs, "linked messages by Message-ID: <$mid>");
 }
+isnt($over->max, 0, 'max is non-zero');
 
 $over->rollback_lazy;