about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiImport.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-03-28 09:01:13 +0000
committerEric Wong <e@80x24.org>2021-03-28 23:01:36 +0000
commit954581b8e575966a8bddc35e3b23d81d16a52833 (patch)
treed5e87f75313f827411796d82871fd6b1d5388e9c /lib/PublicInbox/LeiImport.pm
parent29792d70a5d8305f68521664a7fa2e0fe54ff291 (diff)
downloadpublic-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/LeiImport.pm')
-rw-r--r--lib/PublicInbox/LeiImport.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/LeiImport.pm b/lib/PublicInbox/LeiImport.pm
index 7c5b7d09..803b5cda 100644
--- a/lib/PublicInbox/LeiImport.pm
+++ b/lib/PublicInbox/LeiImport.pm
@@ -76,11 +76,11 @@ sub lei_import { # the main "lei import" method
         my $ops = { '' => [ \&import_done, $lei ] };
         $lei->{auth}->op_merge($ops, $self) if $lei->{auth};
         $self->{-wq_nr_workers} = $j // 1; # locked
-        my $op = $lei->workers_start($self, 'lei_import', undef, $ops);
+        my ($op_c, undef) = $lei->workers_start($self, 'lei_import', $j, $ops);
         $lei->{imp} = $self;
         $self->wq_io_do('input_stdin', []) if $self->{0};
         net_merge_complete($self) unless $lei->{auth};
-        while ($op && $op->{sock}) { $op->event_step }
+        $op_c->op_wait_event($ops);
 }
 
 no warnings 'once';