]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Import.pm
lei import: vivify external-only messages
[public-inbox.git] / lib / PublicInbox / Import.pm
index b8fa5c217ed99b344019e423cd4a384e6f5bd38c..347382791c3c5bea4401aa8c17262d2296c8ca0d 100644 (file)
@@ -413,7 +413,19 @@ sub add {
                $smsg->{blob} = $self->get_mark(":$blob");
                $smsg->set_bytes($raw_email, $n);
                if (my $oidx = delete $smsg->{-oidx}) { # used by LeiStore
-                       return if $oidx->blob_exists($smsg->{blob});
+                       my @docids = $oidx->blob_exists($smsg->{blob});
+                       my @vivify_xvmd;
+                       for my $id (@docids) {
+                               if (my $cur = $oidx->get_art($id)) {
+                                       # already imported if bytes > 0
+                                       return if $cur->{bytes} > 0;
+                                       push @vivify_xvmd, $id;
+                               } else {
+                                       warn "W: $smsg->{blob} ",
+                                               "#$id gone (bug?)\n";
+                               }
+                       }
+                       $smsg->{-vivify_xvmd} = \@vivify_xvmd;
                }
        }
        my $ref = $self->{ref};