From 668073ff057e0178f70cd438d3c799ed6dd21be8 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 11 Sep 2021 23:30:46 +0000 Subject: www: use ->ALL for per-inbox manifest.js.gz, too With 11 epochs on LKML, the lkml/manifest.js.gz response time goes from around 60ms to around 10ms, a significant improvement. And improve test coverage while we're at it. --- lib/PublicInbox/ManifestJsGz.pm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/PublicInbox/ManifestJsGz.pm b/lib/PublicInbox/ManifestJsGz.pm index cde60245..d5048a96 100644 --- a/lib/PublicInbox/ManifestJsGz.pm +++ b/lib/PublicInbox/ManifestJsGz.pm @@ -53,6 +53,7 @@ sub slow_manifest_add ($$) { manifest_add($ctx, $ibx); } }; + warn "E: $@" if $@; } sub eidx_manifest_add ($$$) { @@ -65,6 +66,10 @@ sub eidx_manifest_add ($$$) { } } else { warn "E: `${\$ibx->eidx_key}' not indexed by $ALL->{topdir}\n"; + # do not use slow path for global manifest since + # it can become catastrophically slow. per-inbox manifest + # is not too bad with dozens of epochs, so never fail that: + slow_manifest_add($ctx, $ibx) if $ibx == $ctx->{ibx}; } } @@ -85,12 +90,8 @@ sub response { sub ibx_entry { my ($ctx, $ibx) = @_; my $ALL = $ctx->{www}->{pi_cfg}->ALL; - if ($ALL) { # FIXME: test this in t/ - eidx_manifest_add($ctx, $ALL, $ibx); - } else { + $ALL ? eidx_manifest_add($ctx, $ALL, $ibx) : slow_manifest_add($ctx, $ibx); - warn "E: $@" if $@; - } } sub hide_key { 'manifest' } # for WwwListing->list_match_i @@ -112,8 +113,7 @@ sub psgi_triple { sub per_inbox { my ($ctx) = @_; - # only one inbox, slow is probably OK - slow_manifest_add($ctx, $ctx->{ibx}); + ibx_entry($ctx, $ctx->{ibx}); psgi_triple($ctx); } -- cgit v1.2.3-24-ge0c7