mirror of
https://github.com/whyour/qinglong.git
synced 2026-09-19 14:59:43 +08:00
* perf: load HTTP dependencies only in the HTTP worker * docs: record 30-minute idle resource comparison * perf: isolate database initialization from the cluster primary * docs: record isolated database startup resource comparison * perf: avoid an extra shell child in Docker health probes * perf: load notification dependencies only when needed * perf: retain queue cleanup after notification loading comparison * fix: stop page polling after unmount and avoid duplicate fetches * perf: share WebSocket session polling across connections * docs: measure real WebSocket container CPU and memory * perf: reuse JWT validation within each WebSocket session check * perf: bound login IP lookup allocations with an address cache * refactor: limit resource optimization PR to three core changes * docs: benchmark the three core optimizations against develop * chore: remove documentation and benchmark artifacts from PR
27 lines
826 B
TypeScript
27 lines
826 B
TypeScript
import { errStack } from '../shared/errors';
|
|
|
|
// Also terminate if the primary disappears without forwarding a signal.
|
|
const onParentDisconnect = () => process.exit(1);
|
|
process.once('disconnect', onParentDisconnect);
|
|
|
|
async function initializeDatabase() {
|
|
const { sequelize } = await import('../data');
|
|
try {
|
|
const { default: loadDatabase } = await import('../loaders/db');
|
|
await loadDatabase();
|
|
} finally {
|
|
await sequelize.close();
|
|
}
|
|
}
|
|
|
|
initializeDatabase()
|
|
.catch((error) => {
|
|
console.error(`[boot] Database initialization failed:\n${errStack(error)}`);
|
|
process.exitCode = 1;
|
|
})
|
|
.finally(() => {
|
|
process.removeListener('disconnect', onParentDisconnect);
|
|
// Let pending log writes drain and exit naturally after closing SQLite.
|
|
if (process.connected) process.disconnect();
|
|
});
|