]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/NNTPD.pm
update copyrights for 2021
[public-inbox.git] / lib / PublicInbox / NNTPD.pm
index 953228d0287823ea691e461fb5fae5b86f8c6e99..1e4ddd18430e5d4c904ad556b8f97f7f0f0f7b45 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2016-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # represents an NNTPD (currently a singleton),
@@ -36,10 +36,12 @@ sub refresh_groups {
        my ($self, $sig) = @_;
        my $pi_cfg = $sig ? PublicInbox::Config->new : $self->{pi_cfg};
        my $groups = $pi_cfg->{-by_newsgroup}; # filled during each_inbox
+       my $cache = eval { $pi_cfg->ALL->misc->nntpd_cache_load } // {};
        $pi_cfg->each_inbox(sub {
                my ($ibx) = @_;
-               my $ngname = $ibx->{newsgroup};
-               if (defined($ngname) && $ibx->nntp_usable) {
+               my $ngname = $ibx->{newsgroup} // return;
+               my $ce = $cache->{$ngname};
+               if (($ce and (%$ibx = (%$ibx, %$ce))) || $ibx->nntp_usable) {
                        # only valid if msgmap and over works
                        # preload to avoid fragmentation:
                        $ibx->description;