diff --git a/packages/hydrooj/src/entry/common.ts b/packages/hydrooj/src/entry/common.ts index 20fb1c4d2..73467f115 100644 --- a/packages/hydrooj/src/entry/common.ts +++ b/packages/hydrooj/src/entry/common.ts @@ -68,7 +68,7 @@ export async function builtinModel(ctx: Context) { } export async function locale(pending: string[], fail: string[]) { - await Promise.all(pending.map(async (i) => { + for (const i of pending) { const p = locateFile(i, ['locale', 'locales']); if (p && (await fs.stat(p)).isDirectory() && !fail.includes(i)) { try { @@ -86,7 +86,7 @@ export async function locale(pending: string[], fail: string[]) { logger.error(e); } } - })); + } await bus.parallel('app/load/locale'); } diff --git a/packages/hydrooj/src/service/watcher.ts b/packages/hydrooj/src/service/watcher.ts index f5073e6e5..2c268e150 100644 --- a/packages/hydrooj/src/service/watcher.ts +++ b/packages/hydrooj/src/service/watcher.ts @@ -152,7 +152,7 @@ export default class Watcher extends Service { for (const filename in require.cache) { const module = require.cache[filename]; const plugin = unwrapExports(module.exports); - if (!(typeof plugin === 'object' && 'apply' in plugin)) continue; + if (!(typeof plugin === 'object' && plugin && 'apply' in plugin)) continue; const runtime = this.ctx.registry.get(plugin); if (!runtime || this.declined.has(filename)) continue; pending.set(filename, runtime);