core: update hook usage

This commit is contained in:
undefined committed 2022-09-23 20:10:36 +08:00
1 parent ab933bc9d5
commit 757b5e6bc1
27 files changed
+63 -64

No files matched your search

+2 -3
View File
@@ -6,7 +6,6 @@ import cac from 'cac';
import fs from 'fs-extra';
import { Context } from '../context';
import { Logger } from '../logger';
import * as bus from '../service/bus';
import db from '../service/db';
import {
addon, handler, lib, locale, model,
@@ -61,7 +60,7 @@ export async function apply(ctx: Context) {
for (const i in global.Hydro.handler) await global.Hydro.handler[i]();
require('../script/index');
await script(pending, fail, ctx);
await bus.serial('app/started');
await ctx.parallel('app/started');
if (process.env.NODE_APP_INSTANCE === '0') {
const scripts = require('../upgrade').default;
let dbVer = (await modelSystem.get('db.ver')) ?? 0;
@@ -82,6 +81,6 @@ export async function apply(ctx: Context) {
}
logger.success('Server started');
process.send?.('ready');
await bus.serial('app/ready');
await ctx.parallel('app/ready');
return { fail };
}