From: Eric Wong Date: Sun, 15 Nov 2020 23:20:17 +0000 (+0000) Subject: searchidx: check for graceful shutdown in log2stack X-Git-Tag: v1.7.0~1631 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=355c345f8eb8ac3edd5545a2548c90bd8b32d66e;p=public-inbox.git searchidx: check for graceful shutdown in log2stack The initial "git log" invocation for a git epoch can be time consuming, so check for graceful shutdown at each line to ensure timely shutdowns and avoid SSD/HDD wear. --- diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index 90d8c8b3..6ff2cf94 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -753,6 +753,7 @@ sub log2stack ($$$) { $range); my ($at, $ct, $stk, $cmt); while (<$fh>) { + return if $sync->{quit}; if (/\A([0-9]+)-([0-9]+)-($OID)$/o) { ($at, $ct, $cmt) = ($1 + 0, $2 + 0, $3); $stk //= PublicInbox::IdxStack->new($cmt);