about summary refs log tree commit homepage
path: root/lib/PublicInbox/NNTPD.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-12-23 08:38:48 +0000
committerEric Wong <e@80x24.org>2020-12-23 23:46:40 +0000
commit4a2e89007cb7b62151cb1869e49b27ebacfc27eb (patch)
tree91b6825adb045aa1d295dddf6ef1029683fac47a /lib/PublicInbox/NNTPD.pm
parent361cdfd0ae67d52d8a589b4ddc6e7fa94d8a9c8d (diff)
downloadpublic-inbox-4a2e89007cb7b62151cb1869e49b27ebacfc27eb.tar.gz
This brings -nntpd startup time down from ~35s to ~5s with 50K
inboxes.

Further improvements ought to be possible with deeper changes to
MiscIdx, since -mda having to load every inbox seems unreasonable;
but this general change is fairly unintrusive.
Diffstat (limited to 'lib/PublicInbox/NNTPD.pm')
-rw-r--r--lib/PublicInbox/NNTPD.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/PublicInbox/NNTPD.pm b/lib/PublicInbox/NNTPD.pm
index 7f9a1d58..6907a03c 100644
--- a/lib/PublicInbox/NNTPD.pm
+++ b/lib/PublicInbox/NNTPD.pm
@@ -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} // return;
-                if ($ibx->nntp_usable) {
+                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;