]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/GitAsyncCat.pm
www_coderepo: an alternative to cgit
[public-inbox.git] / lib / PublicInbox / GitAsyncCat.pm
index 2d601542964224de7c1d4fc630eda40929e50386..613dbf7e9966ed153c09144cc0a507ad03070eed 100644 (file)
@@ -45,10 +45,14 @@ sub event_step {
        }
 }
 
-sub git_tmp_cleanup {
+sub watch_cat {
        my ($git) = @_;
-       $git->cleanup(1) and
-               PublicInbox::DS::add_timer(3, \&git_tmp_cleanup, $git);
+       $git->{async_cat} //= do {
+               my $self = bless { git => $git }, __PACKAGE__;
+               $git->{in}->blocking(0);
+               $self->SUPER::new($git->{in}, EPOLLIN|EPOLLET);
+               \undef; # this is a true ref()
+       };
 }
 
 sub ibx_async_cat ($$$$) {
@@ -66,14 +70,7 @@ sub ibx_async_cat ($$$$) {
                \undef;
        } else { # read-only end of git-cat-file pipe
                $git->cat_async($oid, $cb, $arg);
-               $git->{async_cat} //= do {
-                       my $self = bless { git => $git }, __PACKAGE__;
-                       $git->{in}->blocking(0);
-                       $git->{-tmp} and PublicInbox::DS::add_uniq_timer(
-                                               3, \&git_tmp_cleanup, $git);
-                       $self->SUPER::new($git->{in}, EPOLLIN|EPOLLET);
-                       \undef; # this is a true ref()
-               };
+               watch_cat($git);
        }
 }