From: Eric Wong Date: Mon, 1 Aug 2022 21:24:47 +0000 (+0000) Subject: daemon: share FDs for identical log paths X-Git-Tag: v1.9.0~65 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=86c6704a325c6701a1e47e04859b2c24e1e0fa65;p=public-inbox.git daemon: share FDs for identical log paths We rely on the %logs hash for SIGUSR1 log reopening. Without this sharing, some FDs would be hidden inside its respective {HTTP,IMAP,POP3}D object and not reopened on USR2 --- diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm index ead5afc0..20b07b83 100644 --- a/lib/PublicInbox/Daemon.pm +++ b/lib/PublicInbox/Daemon.pm @@ -104,6 +104,7 @@ sub open_log_path ($$) { # my ($fh, $path) = @_; # $_[0] is modified open $_[0], '>>', $_[1] or die "open(>> $_[1]): $!"; $_[0]->autoflush(1); do_chown($_[1]); + $_[0]; } sub load_mod ($;$$) { @@ -141,8 +142,7 @@ sub load_mod ($;$$) { die "multiple $f= options specified\n" if @$p > 1; check_absolute("$f=", $p->[0]) if $daemonize; $p = File::Spec->canonpath($p->[0]); - open_log_path(my $fh, $p); - $tlsd->{$f} = $logs{$p} = $fh; + $tlsd->{$f} = $logs{$p} //= open_log_path(my $fh, $p); warn "# $scheme://$addr $f=$p\n"; } \%xn;