From 7d42724e82c9e0ecfa07154c7a56e7f21e53e62f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 13 Nov 2020 11:11:44 +0000 Subject: extindex: support graceful shutdown via QUIT/INT/TERM Just like the daemon processes, -extindex now supports graceful shutdown via the same signals. This lets users avoid having to repeat indexing messages when a power outage strikes during a long (multi-hour/day) indexing run. Per-inbox (v1/v2) -index graceful shutdowns are not supported, yet, but is planned for later. --- lib/PublicInbox/IdxStack.pm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/PublicInbox/IdxStack.pm') diff --git a/lib/PublicInbox/IdxStack.pm b/lib/PublicInbox/IdxStack.pm index e7e10de9..c55c5c36 100644 --- a/lib/PublicInbox/IdxStack.pm +++ b/lib/PublicInbox/IdxStack.pm @@ -11,6 +11,8 @@ use constant PACK_FMT => eval { pack('Q', 1) } ? 'A1QQH*H*' : 'A1IIH*H*'; # start off in write-only mode sub new { open(my $io, '+>', undef) or die "open: $!"; + # latest_cmt is still useful when the newest revision is a `d'(elete), + # otherwise we favor $sync->{latest_cmt} for checkpoints and {quit} bless { wr => $io, latest_cmt => $_[1] }, __PACKAGE__ } -- cgit v1.2.3-24-ge0c7