X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FConfig.pm;h=d7eaa3e8f1c5100279deaefc7a0a8f1973023c5d;hb=2c972f3d70caf99488fff300341450e48be6ebf1;hp=d34d11ad5cee2a3ef1d4334e8dc94b044b4e5e85;hpb=f89bd1444a595b569606679293d2d01b0b7a049e;p=public-inbox.git diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm index d34d11ad..d7eaa3e8 100644 --- a/lib/PublicInbox/Config.pm +++ b/lib/PublicInbox/Config.pm @@ -20,6 +20,7 @@ sub new { $self->{-by_addr} ||= {}; $self->{-by_name} ||= {}; $self->{-by_newsgroup} ||= {}; + $self->{-limiters} ||= {}; $self; } @@ -85,6 +86,15 @@ sub lookup_newsgroup { undef; } +sub limiter { + my ($self, $name) = @_; + $self->{-limiters}->{$name} ||= do { + require PublicInbox::Qspawn; + my $key = "limiter.$name.max"; + PublicInbox::Qspawn::Limiter->new($self->{$key}); + }; +} + sub get { my ($self, $inbox, $key) = @_; @@ -131,7 +141,7 @@ sub _fill { my $rv = {}; foreach my $k (qw(mainrepo address filter url newsgroup - watch watchheader)) { + watch watchheader httpbackendmax)) { my $v = $self->{"$pfx.$k"}; $rv->{$k} = $v if defined $v; } @@ -139,6 +149,7 @@ sub _fill { my $name = $pfx; $name =~ s/\Apublicinbox\.//; $rv->{name} = $name; + $rv->{-pi_config} = $self; $rv = PublicInbox::Inbox->new($rv); my $v = $rv->{address}; if (ref($v) eq 'ARRAY') {