openvibers/openvibe.ai Commits
Listen on the socket systemd hands over, so a restart never answers 502 (#215)
Changes
@@@ -112,7 +112,10 @@ async function start({ config, db: givenDb = null, clock = { now: () => Date.nowif (listen && config.memoryJobs && config.memoryJobs.enabled) memoryJobs.start();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);});server.keepAliveTimeout = 65000;
@@ -112,7 +112,10 @@ async function start({ config, db: givenDb = null, clock = { now: () => Date.now
@@ -112,7 +112,10 @@ async function start({ config, db: givenDb = null, clock = { now: () => Date.now
if (listen && config.memoryJobs && config.memoryJobs.enabled) memoryJobs.start();
if (listen && config.memoryJobs && config.memoryJobs.enabled) memoryJobs.start();
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);
});
});
server.keepAliveTimeout = 65000;
server.keepAliveTimeout = 65000;