diff options
author | Eric Wong <e@80x24.org> | 2019-04-19 07:41:22 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-05-06 19:12:15 +0000 |
commit | ce18b29d175ef5f01f05d59c95bcf8e0cd40e611 (patch) | |
tree | 576188ca61f8a2533e0d153baf7d66472a8921c8 /lib/PublicInbox/SearchIdxPart.pm | |
parent | e1ed79d1e99e2c58b3edb370e60904cf656dd823 (diff) | |
download | public-inbox-ce18b29d175ef5f01f05d59c95bcf8e0cd40e611.tar.gz |
This can help users track down the source of warnings when presented with imperfect emails. While we're at it, make the __WARN__ callback in t/v2writable.t a no-op since we don't check for warnings, there.
Diffstat (limited to 'lib/PublicInbox/SearchIdxPart.pm')
-rw-r--r-- | lib/PublicInbox/SearchIdxPart.pm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/PublicInbox/SearchIdxPart.pm b/lib/PublicInbox/SearchIdxPart.pm index 7fe2120a..51d81a0a 100644 --- a/lib/PublicInbox/SearchIdxPart.pm +++ b/lib/PublicInbox/SearchIdxPart.pm @@ -48,8 +48,15 @@ sub spawn_worker { sub partition_worker_loop ($$$$) { my ($self, $r, $part, $bnote) = @_; $0 = "pi-v2-partition[$part]"; + my $current_info = ''; + my $warn_cb = $SIG{__WARN__} || sub { print STDERR @_ }; + local $SIG{__WARN__} = sub { + chomp $current_info; + $warn_cb->("[$part] $current_info: ", @_); + }; $self->begin_txn_lazy; while (my $line = $r->getline) { + $current_info = $line; if ($line eq "commit\n") { $self->commit_txn_lazy; } elsif ($line eq "close\n") { |