-sub refresh_groups () {
- my ($self) = @_;
- my $pi_config = PublicInbox::Config->new;
- my $new = {};
- my @list;
- foreach my $k (keys %$pi_config) {
- $k =~ /\Apublicinbox\.([^\.]+)\.mainrepo\z/ or next;
- my $g = $1;
- my $git_dir = $pi_config->{$k};
- my $addr = $pi_config->{"publicinbox.$g.address"};
- my $ngname = $pi_config->{"publicinbox.$g.newsgroup"};
- my $url = $pi_config->{"publicinbox.$g.url"};
- if (defined $ngname) {
- next if ($ngname eq ''); # disabled
- $g = $ngname;
+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
+ $pi_cfg->each_inbox(sub {
+ my ($ibx) = @_;
+ 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.