diff options
author | Eric Wong <e@80x24.org> | 2022-10-01 00:07:45 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2022-10-01 00:18:49 +0000 |
commit | f9ac22a4b485ae5f8ad981027d8608c13f09530e (patch) | |
tree | 63b5aafa3e5b3b401692d8b865f2115735098781 /lib/PublicInbox/GitAsyncCat.pm | |
parent | 0a8406bbb33f8ea1e432ce3e61796e389535642c (diff) | |
download | public-inbox-f9ac22a4b485ae5f8ad981027d8608c13f09530e.tar.gz |
This prevents temporary directories and git processes from lingering around after WWW solver requests.
Diffstat (limited to 'lib/PublicInbox/GitAsyncCat.pm')
-rw-r--r-- | lib/PublicInbox/GitAsyncCat.pm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/PublicInbox/GitAsyncCat.pm b/lib/PublicInbox/GitAsyncCat.pm index b32c2fd3..2d601542 100644 --- a/lib/PublicInbox/GitAsyncCat.pm +++ b/lib/PublicInbox/GitAsyncCat.pm @@ -45,6 +45,12 @@ sub event_step { } } +sub git_tmp_cleanup { + my ($git) = @_; + $git->cleanup(1) and + PublicInbox::DS::add_timer(3, \&git_tmp_cleanup, $git); +} + sub ibx_async_cat ($$$$) { my ($ibx, $oid, $cb, $arg) = @_; my $git = $ibx->{git} // $ibx->git; @@ -63,6 +69,8 @@ sub ibx_async_cat ($$$$) { $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() }; |