diff options
author | Eric Wong <e@80x24.org> | 2021-08-26 12:33:38 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-08-28 10:37:03 +0000 |
commit | d7780e12856d83b9f5c58586691e2fbe711321ed (patch) | |
tree | 621a3c478ee88ecf17df53fef40e0632bbaf9960 /lib/PublicInbox/Over.pm | |
parent | 9a157ecd55d759418b30a81769eaa05ea8b7e5d5 (diff) | |
download | public-inbox-d7780e12856d83b9f5c58586691e2fbe711321ed.tar.gz |
move ->ids_after from mm to over
Since we favor ->over in WWW and IMAP, move this method to ->over to reduce open files in common cases. This fixes the /$EXTINDEX_NAME/all.mbox.gz endpoint for extindex entries (which may get expensive...).
Diffstat (limited to 'lib/PublicInbox/Over.pm')
-rw-r--r-- | lib/PublicInbox/Over.pm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/PublicInbox/Over.pm b/lib/PublicInbox/Over.pm index 58fdea0e..19da056a 100644 --- a/lib/PublicInbox/Over.pm +++ b/lib/PublicInbox/Over.pm @@ -371,4 +371,15 @@ SELECT COUNT(*) FROM xref3 WHERE oidbin = ? sub blob_exists { oidbin_exists($_[0], pack('H*', $_[1])) } +# used by NNTP.pm +sub ids_after { + my ($self, $num) = @_; + my $ids = dbh($self)->selectcol_arrayref(<<'', undef, $$num); +SELECT num FROM over WHERE num > ? +ORDER BY num ASC LIMIT 1000 + + $$num = $ids->[-1] if @$ids; + $ids; +} + 1; |