From 2c472f1f571ae55155c78bcbc4d420d06266ba63 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 15 Nov 2023 09:21:43 +0000 Subject: lei convert: fix repeat and idempotent v2 output We should be able to treat v2 outputs just like any other mail format, with the exception that content dedupe is always enforced by the v2 format. This allows users hosting v2 public-inboxes to catch up broken synchronization from alternate archives such as the mbox archives hosted by https://lists.gnu.org/ Link: https://public-inbox.org/meta/20231114-hypersonic-papaya-starling-e1cfc8@nitro/ --- lib/PublicInbox/LeiConvert.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox/LeiConvert.pm') diff --git a/lib/PublicInbox/LeiConvert.pm b/lib/PublicInbox/LeiConvert.pm index 22aba81a..4a1f8323 100644 --- a/lib/PublicInbox/LeiConvert.pm +++ b/lib/PublicInbox/LeiConvert.pm @@ -34,9 +34,13 @@ sub process_inputs { # via wq_do $self->SUPER::process_inputs; my $lei = $self->{lei}; delete $lei->{1}; - my $l2m = delete $self->{l2m}; - delete $self->{wcb}; # commit + my $l2m = delete $lei->{l2m}; my $nr_w = delete($l2m->{-nr_write}) // 0; + delete $self->{wcb}; # commit + if (my $v2w = delete $lei->{v2w}) { + $nr_w = $v2w->wq_do('done'); # may die + $v2w->wq_close; + } my $d = (delete($l2m->{-nr_seen}) // 0) - $nr_w; $d = $d ? " ($d duplicates)" : ''; $lei->qerr("# converted $nr_w messages$d"); -- cgit v1.2.3-24-ge0c7