diff options
author | Eric Wong <e@80x24.org> | 2019-01-05 10:41:15 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-01-05 10:41:15 +0000 |
commit | 97c6b564fd79e47ae6fca8de273c2aeaf2f5bea5 (patch) | |
tree | b6f2433ceafc18e00ff6dab20eca02352deb833e /lib/PublicInbox/V2Writable.pm | |
parent | 847c0309da7af8a16935f92bb1965f6a1ba538e7 (diff) | |
download | public-inbox-97c6b564fd79e47ae6fca8de273c2aeaf2f5bea5.tar.gz |
Clearly the AltId stuff was never tested for v2. Ensure this tricky filter (which reuses Msgmap to avoid introducing new serial numbers) doesn't trigger deadlocks SQLite due to opening a DB for writing multiple times. I went through several iterations of this change before going with this one, which is the least intrusive I could fine.
Diffstat (limited to 'lib/PublicInbox/V2Writable.pm')
-rw-r--r-- | lib/PublicInbox/V2Writable.pm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index 07319646..93babed5 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -163,6 +163,19 @@ sub num_for { return if $existing; } + # AltId may pre-populate article numbers (e.g. X-Mail-Count + # or NNTP article number), use that article number if it's + # not in Over. + my $altid = $self->{-inbox}->{altid}; + if ($altid && grep(/:file=msgmap\.sqlite3\z/, @$altid)) { + my $num = $self->{mm}->num_for($mid); + + if (defined $num && !$self->{over}->get_art($num)) { + $$mid0 = $mid; + return $num; + } + } + # very unlikely: warn "<$mid> reused for mismatched content\n"; |