Skip to content

Commit

Permalink
fix(core): Do not duplicate plugins when running work in main process
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Oct 2, 2019
1 parent d5ccc25 commit c040c0b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/core/src/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,19 @@ export async function bootstrapWorker(userConfig: Partial<VendureConfig>): Promi
throw new Error(errorMessage);
} else {
try {
return await bootstrapWorkerInternal(userConfig);
const vendureConfig = await preBootstrapConfig(userConfig);
return await bootstrapWorkerInternal(vendureConfig);
} catch (e) {
Logger.error(`Could not start the worker process: ${e.message}`, 'Vendure Worker');
throw e;
}
}
}

async function bootstrapWorkerInternal(userConfig: Partial<VendureConfig>): Promise<INestMicroservice> {
const config = disableSynchronize(await preBootstrapConfig(userConfig));
async function bootstrapWorkerInternal(
vendureConfig: ReadOnlyRequired<VendureConfig>,
): Promise<INestMicroservice> {
const config = disableSynchronize(vendureConfig);
if (!config.workerOptions.runInMainProcess && (config.logger as any).setDefaultContext) {
(config.logger as any).setDefaultContext('Vendure Worker');
}
Expand Down

0 comments on commit c040c0b

Please sign in to comment.