]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Over.pm
imap: EXAMINE: avoid potential race conditions
[public-inbox.git] / lib / PublicInbox / Over.pm
index 74c8fb862703b5a44bbef229670762fb3c856c1a..e5a980d59eacae3ba699e06af614cc43e83b2d2a 100644 (file)
@@ -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 {