-# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
-# generates manifest.js.gz for grokmirror(1)
+# generates manifest.js.gz for grokmirror(1) via PublicInbox::WWW
+# This doesn't parse manifest.js.gz (that happens in LeiMirror)
package PublicInbox::ManifestJsGz;
-use strict;
-use v5.10.1;
+use v5.12;
use parent qw(PublicInbox::WwwListing);
use PublicInbox::Config;
use IO::Compress::Gzip qw(gzip);
manifest_add($ctx, $ibx);
}
};
+ warn "E: $@" if $@;
}
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};
}
}
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
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);
}