diff options
author | Eric Wong <e@80x24.org> | 2023-01-18 02:10:11 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-01-18 23:25:57 +0000 |
commit | 6bb2079cf610585176d23344047a048f4f8bf3dc (patch) | |
tree | 0e2ab36b52fd55a2c4064134f6a2978170dec863 /lib/PublicInbox | |
parent | 6e9397d12635eae55c9114ed9689413154fed8ce (diff) | |
download | public-inbox-6bb2079cf610585176d23344047a048f4f8bf3dc.tar.gz |
qspawn: use ->DESTROY to force ->finalize
There's apparently a few places where we do not call ->finalize or ->finish and leave dangling limiter slots occupied. I can't reproduce this easily, so it's likely in error-handling paths. I already made ->finalize idempotent when switching to awaitpid since I wanted to rely entirely on DESTROY. However, DESTROY doesn't always fire soon enough (and the client has already seen a response), but using DESTROY as a fallback seems reasonable.. This does the minimum to ensure the limiter is freed up on process exit, but ensuring a finish/finalize call always happens is the goal.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r-- | lib/PublicInbox/Qspawn.pm | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/PublicInbox/Qspawn.pm b/lib/PublicInbox/Qspawn.pm index 02357dbf..78afe718 100644 --- a/lib/PublicInbox/Qspawn.pm +++ b/lib/PublicInbox/Qspawn.pm @@ -104,6 +104,8 @@ sub finalize ($) { } } +sub DESTROY { finalize($_[0]) } # ->finalize is idempotent + sub waitpid_err { # callback for awaitpid my (undef, $self) = @_; # $_[0]: pid $self->{_err} = ''; # for defined check in ->finish |