mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core&ui: langs load fix
This commit is contained in:
1 parent
50cb3eaab5
commit
49693c27d4
8 files changed
+30
-46
No files matched your search
@@ -59,9 +59,10 @@ export const service = getLoader('service', 'service');
|
||||
|
||||
export async function builtinModel(ctx: Context) {
|
||||
const modelDir = path.resolve(__dirname, '..', 'model');
|
||||
const models = ['task', 'blacklist', 'discussion', 'document'];
|
||||
const models = await fs.readdir(modelDir);
|
||||
for (const t of models) {
|
||||
ctx.loader.reloadPlugin(ctx, path.resolve(modelDir, t), {}, `hydrooj/model/${t}`);
|
||||
const q = path.resolve(modelDir, t);
|
||||
if ('apply' in require(q)) ctx.loader.reloadPlugin(ctx, q, {}, `hydrooj/model/${t.split('.')[0]}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import fs from 'fs-extra';
|
||||
import { Context } from '../context';
|
||||
import { Logger } from '../logger';
|
||||
import db from '../service/db';
|
||||
import { sleep } from '../utils';
|
||||
import {
|
||||
addon, builtinModel, handler, lib, locale, model,
|
||||
script, service, setting, template,
|
||||
@@ -67,6 +68,7 @@ export async function apply(ctx: Context) {
|
||||
await ctx.lifecycle.flush();
|
||||
await script(pending, fail, ctx);
|
||||
await ctx.lifecycle.flush();
|
||||
await sleep(1000); // lifecycle.flush won't wait for async function
|
||||
await ctx.parallel('app/started');
|
||||
if (process.env.NODE_APP_INSTANCE === '0') {
|
||||
const scripts = require('../upgrade').default;
|
||||
|
||||
Reference in new issue
Block a user