mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
添加站内消息,修复讨论节点丢失的问题
This commit is contained in:
1 parent
33e277f28f
commit
627e64a901
44 files changed
+582
-540
No files matched your search
+1
-40
@@ -9,46 +9,7 @@ process.stdin.on('data', async (input) => {
|
||||
}
|
||||
});
|
||||
|
||||
global.Hydro = {
|
||||
handler: {},
|
||||
template: {},
|
||||
};
|
||||
|
||||
require('./lib/i18n');
|
||||
require('./utils');
|
||||
|
||||
const bus = require('./service/bus');
|
||||
const loader = require('./lib/loader');
|
||||
|
||||
async function run() {
|
||||
await loader.prepare();
|
||||
await new Promise((resolve) => {
|
||||
const h = () => {
|
||||
console.log('Database connected');
|
||||
bus.unsubscribe(['system_database_connected'], h);
|
||||
resolve();
|
||||
};
|
||||
bus.subscribe(['system_database_connected'], h);
|
||||
require('./service/db');
|
||||
});
|
||||
require('./service/gridfs');
|
||||
require('./service/queue');
|
||||
const server = require('./service/server');
|
||||
const builtinHandler = [
|
||||
'home', 'problem', 'record', 'judge', 'user',
|
||||
'contest', 'training', 'discussion', 'manage', 'import',
|
||||
];
|
||||
for (const i of builtinHandler) require(`./handler/${i}`);
|
||||
await loader.model();
|
||||
await loader.handler();
|
||||
for (const i in global.Hydro.handler) {
|
||||
await global.Hydro.handler[i].apply();
|
||||
}
|
||||
const notfound = require('./handler/notfound');
|
||||
await notfound.apply();
|
||||
server.start();
|
||||
}
|
||||
run().catch((e) => {
|
||||
require('./loader')().catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in new issue
Block a user