openvibers/openvibe.search Commits
Listen on the socket systemd hands over, so a restart never answers 502 (#150)
Changes
@@@ -87,7 +87,10 @@ async function start({ config, db: givenDb = null, now = () => Date.now(), fetchlet accountSubscription = 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);});log.log(`[search] listening on http://${config.host}:${server.address().port} (engine ${engine.name})`);
@@ -87,7 +87,10 @@ async function start({ config, db: givenDb = null, now = () => Date.now(), fetch
@@ -87,7 +87,10 @@ async function start({ config, db: givenDb = null, now = () => Date.now(), fetch
let accountSubscription = null;
let accountSubscription = 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);
});
});
log.log(`[search] listening on http://${config.host}:${server.address().port} (engine ${engine.name})`);
log.log(`[search] listening on http://${config.host}:${server.address().port} (engine ${engine.name})`);