core: fix concurrent load of locale

This commit is contained in:
undefined committed 2022-10-24 02:57:28 +08:00
1 parent c00c2160ec
commit 174dd08fff
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -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');
}
+1 -1
View File
@@ -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);