From dbf250d9423ccc38377c35eef8d43e3e11723253 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 16 Dec 2020 23:19:04 +0000 Subject: inbox: simplify v2 epoch counting Perl readdir detects list context and can return an array suitable for the grep op. From there, we can rely on substr to remove the ".git" suffix and integerize the value to save a few bytes before letting List::Util::max return the value. This is how we detect Xapian shards nowadays, too, and we'll also use defined-or (//) to simplify the return value there. We'll also simplify InboxWritable->git_dir_latest, remove some callers, and consider removing it entirely. --- lib/PublicInbox/ExtSearchIdx.pm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/PublicInbox/ExtSearchIdx.pm') diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm index f492734a..3764612c 100644 --- a/lib/PublicInbox/ExtSearchIdx.pm +++ b/lib/PublicInbox/ExtSearchIdx.pm @@ -290,9 +290,7 @@ sub _sync_inbox ($$$) { my $v = $ibx->version; my $ekey = $ibx->eidx_key; if ($v == 2) { - my $epoch_max; - defined($ibx->git_dir_latest(\$epoch_max)) or return; - $sync->{epoch_max} = $epoch_max; + $sync->{epoch_max} = $ibx->max_git_epoch // return; sync_prepare($self, $sync); # or return # TODO: once MiscIdx is stable } elsif ($v == 1) { my $uv = $ibx->uidvalidity; -- cgit v1.2.3-24-ge0c7