From ac22adc97342323e056bb36f9434458cc822e7d9 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 1 Oct 2022 15:52:50 -0300 Subject: www_stream: use DESTROY to cleanup temporary gits 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") --- lib/PublicInbox/WwwStream.pm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/PublicInbox/WwwStream.pm') 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; -- cgit v1.2.3-24-ge0c7