]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SearchIdxPart.pm
index: warn with info about the message as context
[public-inbox.git] / lib / PublicInbox / SearchIdxPart.pm
index 7fe2120a425488eb0c076aeb35825dd681101081..51d81a0a21560ef73cac1776f5176f8a29df16e0 100644 (file)
@@ -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") {