]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/NNTPD.pm
nntp: xref_by_tc: simplify slightly
[public-inbox.git] / lib / PublicInbox / NNTPD.pm
index 967850e9d6ec7e713532fe917e3974f4f36a96c4..03c56db30727ec2dbee9e205592bd459f78ef892 100644 (file)
@@ -38,13 +38,18 @@ sub refresh_groups {
        my $groups = $pi_config->{-by_newsgroup}; # filled during each_inbox
        $pi_config->each_inbox(sub {
                my ($ibx) = @_;
-               my $ngname = $ibx->{newsgroup} // return;
-               if ($ibx->nntp_usable) { # only valid if msgmap and over works
+               my $ngname = $ibx->{newsgroup};
+               if (defined($ngname) && $ibx->nntp_usable) {
+                       # only valid if msgmap and over works
                        # preload to avoid fragmentation:
                        $ibx->description;
                        $ibx->base_url;
                } else {
                        delete $groups->{$ngname};
+                       delete $ibx->{newsgroup};
+                       # Note: don't be tempted to delete more for memory
+                       # savings just yet: NNTP, IMAP, and WWW may all
+                       # run in the same process someday.
                }
        });
        $self->{groupnames} = [ sort(keys %$groups) ];