Browse Source

fix(core): Set worker to run off main process by default

Michael Bromley 6 years ago
parent
commit
8e14213a23

+ 1 - 1
packages/core/src/config/default-config.ts

@@ -81,7 +81,7 @@ export const defaultConfig: ReadOnlyRequired<VendureConfig> = {
         importAssetsDir: __dirname,
         importAssetsDir: __dirname,
     },
     },
     workerOptions: {
     workerOptions: {
-        runInMainProcess: true,
+        runInMainProcess: false,
         transport: Transport.TCP,
         transport: Transport.TCP,
         options: {
         options: {
             port: 3001,
             port: 3001,

+ 17 - 1
packages/core/src/config/vendure-config.ts

@@ -318,6 +318,22 @@ export interface ImportExportOptions {
  * @description
  * @description
  * Options related to the Vendure Worker.
  * Options related to the Vendure Worker.
  *
  *
+ * @example
+ * ```TypeScript
+ * import { Transport } from '\@nestjs/microservices';
+ *
+ * const config: VendureConfig = {
+ *     // ...
+ *     workerOptions: {
+ *         transport: Transport.TCP,
+ *         options: {
+ *             host: 'localhost',
+ *             port: 3001,
+ *         },
+ *     },
+ * }
+ * ```
+ *
  * @docsCategory worker
  * @docsCategory worker
  */
  */
 export interface WorkerOptions {
 export interface WorkerOptions {
@@ -328,7 +344,7 @@ export interface WorkerOptions {
      * testing purposes, not for production, since running the Worker in the main process negates the benefits
      * testing purposes, not for production, since running the Worker in the main process negates the benefits
      * of having long-running or expensive tasks run in the background.
      * of having long-running or expensive tasks run in the background.
      *
      *
-     * @default true
+     * @default false
      */
      */
     runInMainProcess?: boolean;
     runInMainProcess?: boolean;
     /**
     /**