about summary refs log tree commit homepage
path: root/lib/PublicInbox/NNTP.pm
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-04-03 11:09:11 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-04-03 12:06:15 +0000
commit445d2062a60959a04b55d7d1fe4439eff23cd44d (patch)
tree653eea288da968a04561224bc1ba079ed644ded3 /lib/PublicInbox/NNTP.pm
parent0dceebd0a85774c92af247e6da5e2f5a0ee8417c (diff)
downloadpublic-inbox-445d2062a60959a04b55d7d1fe4439eff23cd44d.tar.gz
id_batch had a an overly complicated interface, replace it
with id_batch which is simpler and takes advantage of
selectcol_arrayref in DBI.  This allows simplification of
callers and the diffstat agrees with me.
Diffstat (limited to 'lib/PublicInbox/NNTP.pm')
-rw-r--r--lib/PublicInbox/NNTP.pm12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index ff6d8958..b91cda1d 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -34,7 +34,6 @@ my $LIST_HEADERS = join("\r\n", @OVERVIEW,
                         qw(:bytes :lines Xref To Cc)) . "\r\n";
 
 # disable commands with easy DoS potential:
-# LISTGROUP could get pretty bad, too...
 my %DISABLED; # = map { $_ => 1 } qw(xover list_overview_fmt newnews xhdr);
 
 my $EXPMAP; # fd -> [ idle_time, $self ]
@@ -225,15 +224,12 @@ sub cmd_listgroup ($;$) {
         }
 
         $self->{ng} or return '412 no newsgroup selected';
+        my $n = 0;
         long_response($self, 0, long_response_limit, sub {
                 my ($i) = @_;
-                my $nr = $self->{ng}->mm->id_batch($$i, sub {
-                        my ($ary) = @_;
-                        more($self, join("\r\n", @$ary));
-                });
-
-                # -1 to adjust for implicit increment in long_response
-                $$i = $nr ? $$i + $nr - 1 : long_response_limit;
+                my $ary = $self->{ng}->mm->ids_after(\$n);
+                scalar @$ary or return ($$i = long_response_limit);
+                more($self, join("\r\n", @$ary));
         });
 }