changed timeouts for connection cleanup

This commit is contained in:
Jan Prochazka
2022-11-13 11:59:57 +01:00
parent 6cca81f8f1
commit dc576e6ced
4 changed files with 10 additions and 8 deletions

View File

@@ -335,11 +335,11 @@ function start() {
setInterval(() => { setInterval(() => {
const time = new Date().getTime(); const time = new Date().getTime();
if (time - lastPing > 120 * 1000) { if (time - lastPing > 40_000) {
console.log('Database connection not alive, exiting'); console.log('Database connection not alive, exiting');
process.exit(0); process.exit(0);
} }
}, 60 * 1000); }, 10_000);
process.on('message', async message => { process.on('message', async message => {
if (handleProcessCommunication(message)) return; if (handleProcessCommunication(message)) return;

View File

@@ -111,11 +111,11 @@ function start() {
setInterval(() => { setInterval(() => {
const time = new Date().getTime(); const time = new Date().getTime();
if (time - lastPing > 120 * 1000) { if (time - lastPing > 40_000) {
console.log('Server connection not alive, exiting'); console.log('Server connection not alive, exiting');
process.exit(0); process.exit(0);
} }
}, 60 * 1000); }, 10_000);
process.on('message', async message => { process.on('message', async message => {
if (handleProcessCommunication(message)) return; if (handleProcessCommunication(message)) return;

View File

@@ -292,13 +292,15 @@ async function handleMessage({ msgtype, ...other }) {
function start() { function start() {
childProcessChecker(); childProcessChecker();
lastPing = new Date().getTime();
setInterval(() => { setInterval(() => {
const time = new Date().getTime(); const time = new Date().getTime();
if (time - lastPing > 30_000) { if (time - lastPing > 25_000) {
console.log('Session not alive, exiting'); console.log('Session not alive, exiting');
process.exit(0); process.exit(0);
} }
}, 30_000); }, 10_000);
process.on('message', async message => { process.on('message', async message => {
if (handleProcessCommunication(message)) return; if (handleProcessCommunication(message)) return;

View File

@@ -29,12 +29,12 @@ export function subscribeConnectionPingers() {
openedConnections.subscribe(value => { openedConnections.subscribe(value => {
doServerPing(value); doServerPing(value);
if (openedConnectionsHandle) window.clearInterval(openedConnectionsHandle); if (openedConnectionsHandle) window.clearInterval(openedConnectionsHandle);
openedConnectionsHandle = window.setInterval(() => doServerPing(value), 30 * 1000); openedConnectionsHandle = window.setInterval(() => doServerPing(value), 30_000);
}); });
currentDatabase.subscribe(value => { currentDatabase.subscribe(value => {
doDatabasePing(value); doDatabasePing(value);
if (currentDatabaseHandle) window.clearInterval(currentDatabaseHandle); if (currentDatabaseHandle) window.clearInterval(currentDatabaseHandle);
currentDatabaseHandle = window.setInterval(() => doDatabasePing(value), 30 * 1000); currentDatabaseHandle = window.setInterval(() => doDatabasePing(value), 30_000);
}); });
} }