diff options
author | Eric Wong <e@80x24.org> | 2023-10-31 20:42:50 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-11-01 07:08:08 +0000 |
commit | 196f753fb25447b7e8d61a5c0e4c62b464a8e03d (patch) | |
tree | a49ca5a890dfc23e27886bdd3c57ac6f572475af /lib | |
parent | 1cbebe89b46091ef7f9f64e6bbda98f82cff2dd7 (diff) | |
download | public-inbox-196f753fb25447b7e8d61a5c0e4c62b464a8e03d.tar.gz |
Drop reference counts ASAP in case it saves us some memory sooner rather than later. This ought to give us more predictable resource use and ensure OnDestroy callbacks fire sooner. There's no need to use `local' to clobber the arrayref anymore, either. AFAIK, this doesn't fix any known bug, but more predictability will make it easier to debug things going forward.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/DS.pm | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm index 6041c6b5..708fe14d 100644 --- a/lib/PublicInbox/DS.pm +++ b/lib/PublicInbox/DS.pm @@ -136,16 +136,12 @@ sub _InitPoller () { sub now () { clock_gettime(CLOCK_MONOTONIC) } sub next_tick () { - local $cur_runq = $nextq or return; + $cur_runq = $nextq or return; $nextq = undef; - for my $obj (@$cur_runq) { + while (my $obj = shift @$cur_runq) { # avoid "ref" on blessed refs to workaround a Perl 5.16.3 leak: # https://rt.perl.org/Public/Bug/Display.html?id=114340 - if (blessed($obj)) { - $obj->event_step; - } else { - $obj->(); - } + blessed($obj) ? $obj->event_step : $obj->(); } } |