SYNC: health status

This commit is contained in:
SPRINX0\prochazka
2025-03-17 13:55:58 +01:00
committed by Diflow
parent d5f8e01dd8
commit 3bb4652a49
5 changed files with 40 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
const os = require('os');
const databaseConnections = require('../controllers/databaseConnections');
const serverConnections = require('../controllers/serverConnections');
const sessions = require('../controllers/sessions');
const runners = require('../controllers/runners');
async function getHealthStatus() {
const memory = process.memoryUsage();
return {
status: 'ok',
databaseConnectionCount: databaseConnections.opened.length,
serverConnectionCount: serverConnections.opened.length,
sessionCount: sessions.opened.length,
memory,
systemMemory: {
total: os.totalmem(),
free: os.freemem(),
},
runProcessCount: runners.opened.length,
};
}
module.exports = getHealthStatus;