about summary refs log tree commit homepage
path: root/lib/PublicInbox/ManifestJsGz.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-09-11 23:30:46 +0000
committerEric Wong <e@80x24.org>2021-09-12 03:00:19 +0000
commit668073ff057e0178f70cd438d3c799ed6dd21be8 (patch)
treec19d6a3cc1ccb3995dbe1d90fcbe9f3296c1041b /lib/PublicInbox/ManifestJsGz.pm
parent610d89af015337ac0ba09dedeb71d1ff1d2326ea (diff)
downloadpublic-inbox-668073ff057e0178f70cd438d3c799ed6dd21be8.tar.gz
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.
Diffstat (limited to 'lib/PublicInbox/ManifestJsGz.pm')
-rw-r--r--lib/PublicInbox/ManifestJsGz.pm14
1 files changed, 7 insertions, 7 deletions
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);
 }