diff options
author | Eric Wong <e@yhbt.net> | 2020-06-25 10:09:37 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-06-27 10:08:29 +0000 |
commit | 89efc8f4e8d603e4fad3c4c754e23561d82de2c1 (patch) | |
tree | 238aaad487b111782cdae773111f1d8bbedcdc02 /lib/PublicInbox/Over.pm | |
parent | 2a06fc8e54607e7d418ee746ab4e17ad48716c6d (diff) | |
download | public-inbox-89efc8f4e8d603e4fad3c4c754e23561d82de2c1.tar.gz |
We need to rely on num_highwater for UIDNEXT since the highest `num' stored in over.sqlite3 may be rolled back if the most recent messages were spam. We also need to load the uo2m immediately on EXAMINE to ensure EXISTS responses are always consistent with regard to future updates.
Diffstat (limited to 'lib/PublicInbox/Over.pm')
-rw-r--r-- | lib/PublicInbox/Over.pm | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/lib/PublicInbox/Over.pm b/lib/PublicInbox/Over.pm index 74c8fb86..e5a980d5 100644 --- a/lib/PublicInbox/Over.pm +++ b/lib/PublicInbox/Over.pm @@ -248,25 +248,13 @@ SELECT MAX(num) FROM over WHERE num > 0 $sth->fetchrow_array // 0; } -sub imap_status { +sub imap_exists { my ($self, $uid_base, $uid_end) = @_; - my $dbh = $self->connect; - my $sth = $dbh->prepare_cached(<<'', undef, 1); + my $sth = $self->connect->prepare_cached(<<'', undef, 1); SELECT COUNT(num) FROM over WHERE num > ? AND num <= ? $sth->execute($uid_base, $uid_end); - my $exists = $sth->fetchrow_array; - - $sth = $dbh->prepare_cached(<<'', undef, 1); -SELECT MAX(num) + 1 FROM over WHERE num <= ? - - $sth->execute($uid_end); - my $uidnext = $sth->fetchrow_array; - - $sth = $dbh->prepare_cached(<<'', undef, 1); -SELECT MAX(num) FROM over WHERE num > 0 - - ($exists, $uidnext, $sth->fetchrow_array // 0); + $sth->fetchrow_array; } sub check_inodes { |