mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: fix concurrent load of locale
This commit is contained in:
1 parent
c00c2160ec
commit
174dd08fff
2 files changed
+3
-3
No files matched your search
@@ -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');
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user