* [PATCH] daemon: refresh before forking
@ 2016-02-27 22:45 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2016-02-27 22:45 UTC (permalink / raw)
To: meta
This means we always load the PSGI server code early for
-httpd. This may make things less compatible with existing
PSGI/Plack apps, but we prioritize our httpd for the uses
of public-inbox itself, first.
And any existing PSGI/Plack app which wants to may adapt
themselves to being preload-friendly.
---
lib/PublicInbox/Daemon.pm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index 2878e33..b8482d3 100644
--- a/lib/PublicInbox/Daemon.pm
+++ b/lib/PublicInbox/Daemon.pm
@@ -363,6 +363,7 @@ sub daemon_loop ($$) {
my ($refresh, $post_accept) = @_;
my $parent_pipe;
if ($worker_processes > 0) {
+ $refresh->(); # preload by default
$parent_pipe = master_loop(); # returns if in child process
my $fd = fileno($parent_pipe);
Danga::Socket->AddOtherFds($fd => sub { kill('TERM', $$) } );
@@ -370,10 +371,10 @@ sub daemon_loop ($$) {
reopen_logs();
$set_user->() if $set_user;
$SIG{USR2} = sub { worker_quit() if upgrade() };
+ $refresh->();
}
$uid = $gid = undef;
reopen_logs();
- $refresh->();
$SIG{QUIT} = $SIG{INT} = $SIG{TERM} = *worker_quit;
$SIG{USR1} = *reopen_logs;
$SIG{HUP} = $refresh;
--
EW
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-02-27 22:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-27 22:45 [PATCH] daemon: refresh before forking Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).