From 355c345f8eb8ac3edd5545a2548c90bd8b32d66e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 15 Nov 2020 23:20:17 +0000 Subject: 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. --- lib/PublicInbox/SearchIdx.pm | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') 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); -- cgit v1.2.3-24-ge0c7