feat: implement comprehensive health check endpoints for API, Auth, and Realtime services to monitor database, Redis, MinIO, and InfluxDB connectivity.
This commit is contained in:
@@ -70,10 +70,24 @@ async function remove(table, condition, params, type = 'users') {
|
||||
const sql = `DELETE FROM ${table} WHERE ${condition}`;
|
||||
return await query(sql, params, type);
|
||||
}
|
||||
|
||||
async function checkPostgres() {
|
||||
const status = {};
|
||||
for (const [name, pool] of Object.entries(pools)) {
|
||||
try {
|
||||
await pool.query('SELECT NOW()');
|
||||
status[name] = 'connected';
|
||||
} catch (error) {
|
||||
status[name] = 'disconnected';
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
module.exports = {
|
||||
query,
|
||||
append,
|
||||
remove,
|
||||
getClient,
|
||||
checkPostgres,
|
||||
pools
|
||||
};
|
||||
Reference in New Issue
Block a user