about summary refs log tree commit homepage
path: root/lib/PublicInbox/WwwStream.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-10-01 15:52:50 -0300
committerEric Wong <e@80x24.org>2022-10-01 23:02:18 +0000
commitac22adc97342323e056bb36f9434458cc822e7d9 (patch)
treef6d3ac9563a203668e3a57b97085335035b12b89 /lib/PublicInbox/WwwStream.pm
parentfa04201baae9d1043e37cf8ef4e5a33fdd0498ff (diff)
downloadpublic-inbox-ac22adc97342323e056bb36f9434458cc822e7d9.tar.gz
Relying on a timer to handle cleanup in f9ac22a4b485 was
sub-optimal since the delay could prove expensive under heavy
traffic.  So rely on ->DESTROY instead since we we no longer
hold reference cycles by the time the show_blob callback
executes.

Fixes: f9ac22a4b485 ("git_async_cat: automatically cleanup temporary gits")
Diffstat (limited to 'lib/PublicInbox/WwwStream.pm')
-rw-r--r--lib/PublicInbox/WwwStream.pm5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm
index 77b6f9c2..16442d51 100644
--- a/lib/PublicInbox/WwwStream.pm
+++ b/lib/PublicInbox/WwwStream.pm
@@ -220,4 +220,9 @@ sub html_init {
         print { $ctx->zfh } html_top($ctx);
 }
 
+sub DESTROY {
+        my ($ctx) = @_;
+        $ctx->{git}->cleanup if $ctx->{git} && $ctx->{git}->{-tmp};
+}
+
 1;