my %Stack;
my $nextq; # queue for next_tick
-my $AWAIT_PIDS; # pid => [ $callback, @args ]
my $reap_armed;
my $ToClose; # sockets to close when event loop is done
-our (
+our ($AWAIT_PIDS, # pid => [ $callback, @args ]
%DescriptorMap, # fd (num) -> PublicInbox::DS object
$Poller, # global Select, Epoll, DSPoll, or DSKQXS ref
}
}
+sub drop_all_stores () {
+ for my $cfg (values %PATH2CFG) {
+ my $sto = delete($cfg->{-lei_store}) // next;
+ eval { $sto->wq_io_do('done') };
+ warn "E: $@ (dropping store for $cfg->{-f})" if $@;
+ $sto->wq_close;
+ }
+}
+
# lei(1) calls this when it can't connect
sub lazy_start {
my ($path, $errno, $narg) = @_;
$s->close;
}
}
- $n; # true: continue, false: stop
+ drop_all_stores() if !$n; # drop stores only if no clients
+ # returns true: continue, false: stop
+ $n + scalar(keys(%$PublicInbox::DS::AWAIT_PIDS));
});
# STDIN was redirected to /dev/null above, closing STDERR and