]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/GzipFilter.pm
treewide: use warn() or carp() instead of env->{psgi.errors}
[public-inbox.git] / lib / PublicInbox / GzipFilter.pm
index 48ed11a5d55cb782c9161a5589e798d63d3a8498..c621617107259ec05954b0eef5370c282f773166 100644 (file)
@@ -84,6 +84,12 @@ sub gzip_or_die () {
        $gz;
 }
 
+sub gone { # what: search/over/mm
+       my ($ctx, $what) = @_;
+       warn "W: `$ctx->{ibx}->{name}' $what went away unexpectedly\n";
+       undef;
+}
+
 # for GetlineBody (via Qspawn) when NOT using $env->{'pi-httpd.async'}
 # Also used for ->getline callbacks
 sub translate ($$) {
@@ -148,8 +154,7 @@ sub close {
 sub bail  {
        my $self = shift;
        if (my $env = $self->{env}) {
-               eval { $env->{'psgi.errors'}->print(@_, "\n") };
-               warn("E: error printing to psgi.errors: $@", @_) if $@;
+               warn @_, "\n";
                my $http = $env->{'psgix.io'} or return; # client abort
                eval { $http->close }; # should hit our close
                warn "E: error in http->close: $@" if $@;
@@ -175,13 +180,17 @@ sub async_blob_cb { # git->cat_async callback
        $smsg->{blob} eq $oid or bail($self, "BUG: $smsg->{blob} != $oid");
        eval { $self->async_eml(PublicInbox::Eml->new($bref)) };
        bail($self, "E: async_eml: $@") if $@;
-       $http->next_step($self->can('async_next'));
+       if ($self->{-low_prio}) {
+               push(@{$self->{www}->{-low_prio_q}}, $self) == 1 and
+                               PublicInbox::DS::requeue($self->{www});
+       } else {
+               $http->next_step($self->can('async_next'));
+       }
 }
 
 sub smsg_blob {
        my ($self, $smsg) = @_;
-       git_async_cat($self->{ibx}->git, $smsg->{blob},
-                       \&async_blob_cb, $self);
+       ibx_async_cat($self->{ibx}, $smsg->{blob}, \&async_blob_cb, $self);
 }
 
 1;