For non-persistent workers, there's no harm in keeping the
client socket open. This means we can avoid dancing around
closing it in PublicInbox::LeiAuth::ipc_atfork_child.
Eventually, other WQ workers will trigger "git credential"
spawning in script/lei directly.
my ($self, $persist) = @_;
# we need to explicitly close things which are on stack
if ($persist) {
- my @io = delete @$self{0,1,2};
+ my @io = delete @$self{qw(0 1 2 sock)};
unless ($self->{oneshot}) {
close($_) for @io;
}
delete $self->{0};
}
delete @$self{qw(cnv)};
- for (delete @$self{qw(3 sock old_1 au_done)}) {
+ for (delete @$self{qw(3 old_1 au_done)}) {
close($_) if defined($_);
}
if (my $op_c = delete $self->{pkt_op_c}) {
sub ipc_atfork_child {
my ($self) = @_;
- # prevent {sock} from being closed in lei_atfork_child:
- my $s = delete $self->{lei}->{sock};
delete $self->{lei}->{auth}; # drop circular ref
$self->{lei}->lei_atfork_child;
- $self->{lei}->{sock} = $s if $s;
$self->SUPER::ipc_atfork_child;
}