diff options
author | Eric Wong <e@80x24.org> | 2021-03-28 09:01:13 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-03-28 23:01:36 +0000 |
commit | 954581b8e575966a8bddc35e3b23d81d16a52833 (patch) | |
tree | d5e87f75313f827411796d82871fd6b1d5388e9c /lib/PublicInbox/LEI.pm | |
parent | 29792d70a5d8305f68521664a7fa2e0fe54ff291 (diff) | |
download | public-inbox-954581b8e575966a8bddc35e3b23d81d16a52833.tar.gz |
Provide a consistent ->op_wait_event method instead of forcing callers to loop (or not) at each callsite. This also avoid a leak possibility by avoiding circular references.
Diffstat (limited to 'lib/PublicInbox/LEI.pm')
-rw-r--r-- | lib/PublicInbox/LEI.pm | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index 478912cd..9cacb142 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -494,11 +494,11 @@ sub _delete_pkt_op { # OnDestroy callback to prevent leaks on die } sub pkt_op_pair { - my ($self, $ops) = @_; + my ($self) = @_; require PublicInbox::OnDestroy; require PublicInbox::PktOp; my $end = PublicInbox::OnDestroy->new($$, \&_delete_pkt_op, $self); - @$self{qw(pkt_op_c pkt_op_p)} = PublicInbox::PktOp->pair($ops); + @$self{qw(pkt_op_c pkt_op_p)} = PublicInbox::PktOp->pair; $end; } @@ -512,14 +512,13 @@ sub workers_start { ($ops ? %$ops : ()), }; $ops->{''} //= [ \&dclose, $lei ]; - my $end = $lei->pkt_op_pair($ops); + my $end = $lei->pkt_op_pair; $wq->wq_workers_start($ident, $jobs, $lei->oldset, { lei => $lei }); delete $lei->{pkt_op_p}; - my $op = delete $lei->{pkt_op_c}; + my $op_c = delete $lei->{pkt_op_c}; @$end = (); $lei->event_step_init; - # oneshot needs $op, daemon-mode uses DS->EventLoop to handle $op - $lei->{oneshot} ? $op : undef; + ($op_c, $ops); } sub _help { |