openvibers/openvibe.events Commits
Listen on the socket systemd hands over, so a restart never answers 502 (#169)
Changes
@@@ -150,7 +150,10 @@ async function start({let server = null;if (listen) {server = await new Promise((resolve, reject) => {-- const s = app.listen(config.port, config.host, () => resolve(s));++ // Socket activation (2026-10-31): systemd's .socket unit holds the listener across restarts, so a deploy++ // queues requests in the kernel instead of answering 502. Without the socket unit, the usual listen.++ const socketActivated = process.env.LISTEN_FDS === '1' && Number(process.env.LISTEN_PID) === process.pid;++ const s = app.listen(...(socketActivated ? [{ fd: 3 }] : [config.port, config.host]), () => resolve(s));s.on('error', reject);});// SSE connections stay open; Node's default keep-alive/header timers only affect idle sockets.
@@ -150,7 +150,10 @@ async function start({
@@ -150,7 +150,10 @@ async function start({
let server = null;
let server = null;
if (listen) {
if (listen) {
server = await new Promise((resolve, reject) => {
server = await new Promise((resolve, reject) => {
- const s = app.listen(config.port, config.host, () => resolve(s));
+ // Socket activation (2026-10-31): systemd's .socket unit holds the listener across restarts, so a deploy
+ // queues requests in the kernel instead of answering 502. Without the socket unit, the usual listen.
+ const socketActivated = process.env.LISTEN_FDS === '1' && Number(process.env.LISTEN_PID) === process.pid;
+ const s = app.listen(...(socketActivated ? [{ fd: 3 }] : [config.port, config.host]), () => resolve(s));
s.on('error', reject);
s.on('error', reject);
});
});
// SSE connections stay open; Node's default keep-alive/header timers only affect idle sockets.
// SSE connections stay open; Node's default keep-alive/header timers only affect idle sockets.