about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-08-19 09:07:45 +0000
committerEric Wong <e@80x24.org>2022-08-19 18:46:48 +0000
commitf3578e1c8dcef710b6b1c5f74270bf4e39ab5dd8 (patch)
treeca0681d2293932c48f4df293a9be5ad3595b1d8c
parentf5aa8e80e77205830e4bbdf938fc2b25cd45865d (diff)
downloadpublic-inbox-f3578e1c8dcef710b6b1c5f74270bf4e39ab5dd8.tar.gz
I may be the only lei user who has redundantly-indexed messages
needing this, though...
-rw-r--r--lib/PublicInbox/LeiStore.pm9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/PublicInbox/LeiStore.pm b/lib/PublicInbox/LeiStore.pm
index 8e710540..57f0e013 100644
--- a/lib/PublicInbox/LeiStore.pm
+++ b/lib/PublicInbox/LeiStore.pm
@@ -344,6 +344,15 @@ sub _reindex_1 { # git->cat_async callback
                 my $eml = PublicInbox::Eml->new($bref);
                 $smsg->{-merge_vmd} = 1; # preserve existing keywords
                 $eidx->idx_shard($smsg->{num})->index_eml($eml, $smsg);
+        } elsif ($type eq 'missing') {
+                # pre-release/buggy lei may've indexed external-only msgs,
+                # try to correct that, here
+                warn("E: missing $hex, culling (ancient lei artifact?)\n");
+                $smsg->{to} = $smsg->{cc} = $smsg->{from} = '';
+                $smsg->{bytes} = 0;
+                $eidx->{oidx}->update_blob($smsg, '');
+                my $eml = PublicInbox::Eml->new("\r\n\r\n");
+                $eidx->idx_shard($smsg->{num})->index_eml($eml, $smsg);
         } else {
                 warn("E: $type $hex\n");
         }