From c040c0bd40942d99bfb8380858c1b5dfb822f79f Mon Sep 17 00:00:00 2001 From: Michael Bromley Date: Wed, 2 Oct 2019 15:58:20 +0200 Subject: [PATCH] fix(core): Do not duplicate plugins when running work in main process --- packages/core/src/bootstrap.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/core/src/bootstrap.ts b/packages/core/src/bootstrap.ts index f5be33323f..e23cd877a1 100644 --- a/packages/core/src/bootstrap.ts +++ b/packages/core/src/bootstrap.ts @@ -102,7 +102,8 @@ export async function bootstrapWorker(userConfig: Partial): 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; @@ -110,8 +111,10 @@ export async function bootstrapWorker(userConfig: Partial): Promi } } -async function bootstrapWorkerInternal(userConfig: Partial): Promise { - const config = disableSynchronize(await preBootstrapConfig(userConfig)); +async function bootstrapWorkerInternal( + vendureConfig: ReadOnlyRequired, +): Promise { + const config = disableSynchronize(vendureConfig); if (!config.workerOptions.runInMainProcess && (config.logger as any).setDefaultContext) { (config.logger as any).setDefaultContext('Vendure Worker'); }