Skip to content

Commit

Permalink
fix(core): When populating, run search index builder on main process
Browse files Browse the repository at this point in the history
This prevents issues with sqlite locking tables when running @vendure/create
  • Loading branch information
michaelbromley committed Jun 7, 2019
1 parent b085e49 commit 6564d3f
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Provider } from '@nestjs/common';
import { SearchReindexResponse } from '@vendure/common/lib/generated-types';
import { CREATING_VENDURE_APP } from '@vendure/common/lib/shared-constants';
import { Type } from '@vendure/common/lib/shared-types';
import gql from 'graphql-tag';

Expand Down Expand Up @@ -76,6 +77,12 @@ export class DefaultSearchPlugin implements VendurePlugin {
runInForkedProcess: true,
};
this.options = { ...defaultOptions, ...options };

if (process.env[CREATING_VENDURE_APP]) {
// For the "create" step we will not run the indexer in a forked process as this
// can cause issues with sqlite locking.
this.options.runInForkedProcess = false;
}
}

/** @internal */
Expand Down

0 comments on commit 6564d3f

Please sign in to comment.