about summary refs log tree commit homepage
path: root/lib/PublicInbox/OverIdx.pm
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-07-17 06:31:55 +0000
committerEric Wong <e@yhbt.net>2020-07-17 20:56:54 +0000
commit592f8239dceb6604e538fd51e62bcce50d6e1972 (patch)
treeb68db6cce6f2567ac6998b19f7c85e876d605e9c /lib/PublicInbox/OverIdx.pm
parentc06e7fc8afea8441ed3d29d63cb8933704b15e7d (diff)
downloadpublic-inbox-592f8239dceb6604e538fd51e62bcce50d6e1972.tar.gz
Since over.sqlite3 seems here to stay, we no longer need to do
Message-ID lookups against Xapian and can simply rely on the
docid <=> NNTP article number equivalancy SCHEMA_VERSION=15
gave us.

This rids us of the closure-using batch_do sub in the v1
code path and vastly simplifies both v1 and v2 unindexing.
Diffstat (limited to 'lib/PublicInbox/OverIdx.pm')
-rw-r--r--lib/PublicInbox/OverIdx.pm13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/PublicInbox/OverIdx.pm b/lib/PublicInbox/OverIdx.pm
index 29c6e0b9..5601e602 100644
--- a/lib/PublicInbox/OverIdx.pm
+++ b/lib/PublicInbox/OverIdx.pm
@@ -326,22 +326,23 @@ INSERT INTO id2num (id, num) VALUES (?,?)
 }
 
 sub _remove_oid {
-        my ($self, $smsg, $oid, $nr) = @_;
+        my ($self, $smsg, $oid, $removed) = @_;
         if (!defined($oid) || $smsg->{blob} eq $oid) {
                 delete_by_num($self, $smsg->{num});
-                $$nr++;
+                push @$removed, $smsg->{num};
         }
         1;
 }
 
-# returns number of removed messages
+# returns number of removed messages in scalar context,
+# array of removed article numbers in array context.
 # $oid may be undef to match only on $mid
 sub remove_oid {
         my ($self, $oid, $mid) = @_;
-        my $nr = 0;
+        my $removed = [];
         begin_lazy($self);
-        each_by_mid($self, $mid, ['ddd'], \&_remove_oid, $oid, \$nr);
-        $nr;
+        each_by_mid($self, $mid, ['ddd'], \&_remove_oid, $oid, $removed);
+        @$removed;
 }
 
 sub _num_mid0_for_oid {