]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Inbox.pm
www*stream: gzip ->getline responses
[public-inbox.git] / lib / PublicInbox / Inbox.pm
index 407751c30637c7b3988b051140bbdc16a385cf0c..02186dac717fa329b6fb508d8eeab2c18919bca0 100644 (file)
@@ -22,9 +22,6 @@ my $CLEANUP = {}; # string(inbox) -> inbox
 sub git_cleanup ($) {
        my ($self) = @_;
        my $git = $self->{git} or return;
-       if (my $async_cat = delete $self->{async_cat}) {
-               $async_cat->close;
-       }
        $git->cleanup;
 }
 
@@ -34,7 +31,7 @@ sub cleanup_task () {
        for my $ibx (values %$CLEANUP) {
                my $again;
                if ($have_devel_peek) {
-                       foreach my $f (qw(mm search over)) {
+                       foreach my $f (qw(mm search)) {
                                # we bump refcnt by assigning tmp, here:
                                my $tmp = $ibx->{$f} or next;
                                next if Devel::Peek::SvREFCNT($tmp) > 2;
@@ -48,9 +45,9 @@ sub cleanup_task () {
                                $again = 1 if $git->cleanup;
                        }
                }
+               check_inodes($ibx);
                if ($have_devel_peek) {
-                       $again ||= !!($ibx->{over} || $ibx->{mm} ||
-                                     $ibx->{search});
+                       $again ||= !!($ibx->{mm} || $ibx->{search});
                }
                $next->{"$ibx"} = $ibx if $again;
        }
@@ -410,12 +407,21 @@ sub unsubscribe_unlock {
        delete $self->{unlock_subs}->{$ident};
 }
 
+sub check_inodes ($) {
+       my ($self) = @_;
+       for (qw(over)) { # TODO: search, mm
+               $self->{$_}->check_inodes if $self->{$_};
+       }
+}
+
 # called by inotify
 sub on_unlock {
        my ($self) = @_;
+       check_inodes($self);
        my $subs = $self->{unlock_subs} or return;
        for (values %$subs) {
                eval { $_->on_inbox_unlock($self) };
+               warn "E: $@ ($self->{inboxdir})\n" if $@;
        }
 }