|
@@ -2,6 +2,7 @@ import { NodeOptions } from '@elastic/elasticsearch';
|
|
|
import { OnApplicationBootstrap } from '@nestjs/common';
|
|
import { OnApplicationBootstrap } from '@nestjs/common';
|
|
|
import {
|
|
import {
|
|
|
AssetEvent,
|
|
AssetEvent,
|
|
|
|
|
+ BUFFER_SEARCH_INDEX_UPDATES,
|
|
|
CollectionModificationEvent,
|
|
CollectionModificationEvent,
|
|
|
EventBus,
|
|
EventBus,
|
|
|
HealthCheckRegistryService,
|
|
HealthCheckRegistryService,
|
|
@@ -13,6 +14,7 @@ import {
|
|
|
ProductEvent,
|
|
ProductEvent,
|
|
|
ProductVariantChannelEvent,
|
|
ProductVariantChannelEvent,
|
|
|
ProductVariantEvent,
|
|
ProductVariantEvent,
|
|
|
|
|
+ SearchJobBufferService,
|
|
|
TaxRateModificationEvent,
|
|
TaxRateModificationEvent,
|
|
|
Type,
|
|
Type,
|
|
|
VendurePlugin,
|
|
VendurePlugin,
|
|
@@ -201,7 +203,12 @@ import { ElasticsearchOptions, ElasticsearchRuntimeOptions, mergeWithDefaults }
|
|
|
ElasticsearchService,
|
|
ElasticsearchService,
|
|
|
ElasticsearchHealthIndicator,
|
|
ElasticsearchHealthIndicator,
|
|
|
ElasticsearchIndexerController,
|
|
ElasticsearchIndexerController,
|
|
|
|
|
+ SearchJobBufferService,
|
|
|
{ provide: ELASTIC_SEARCH_OPTIONS, useFactory: () => ElasticsearchPlugin.options },
|
|
{ provide: ELASTIC_SEARCH_OPTIONS, useFactory: () => ElasticsearchPlugin.options },
|
|
|
|
|
+ {
|
|
|
|
|
+ provide: BUFFER_SEARCH_INDEX_UPDATES,
|
|
|
|
|
+ useFactory: () => ElasticsearchPlugin.options.bufferUpdates === true,
|
|
|
|
|
+ },
|
|
|
],
|
|
],
|
|
|
adminApiExtensions: { resolvers: [AdminElasticSearchResolver, EntityElasticSearchResolver] },
|
|
adminApiExtensions: { resolvers: [AdminElasticSearchResolver, EntityElasticSearchResolver] },
|
|
|
shopApiExtensions: {
|
|
shopApiExtensions: {
|
|
@@ -314,6 +321,7 @@ export class ElasticsearchPlugin implements OnApplicationBootstrap {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ // TODO: Remove this buffering logic because because we have dedicated buffering based on #1137
|
|
|
const collectionModification$ = this.eventBus.ofType(CollectionModificationEvent);
|
|
const collectionModification$ = this.eventBus.ofType(CollectionModificationEvent);
|
|
|
const closingNotifier$ = collectionModification$.pipe(debounceTime(50));
|
|
const closingNotifier$ = collectionModification$.pipe(debounceTime(50));
|
|
|
collectionModification$
|
|
collectionModification$
|
|
@@ -335,6 +343,7 @@ export class ElasticsearchPlugin implements OnApplicationBootstrap {
|
|
|
// The delay prevents a "TransactionNotStartedError" (in SQLite/sqljs) by allowing any existing
|
|
// The delay prevents a "TransactionNotStartedError" (in SQLite/sqljs) by allowing any existing
|
|
|
// transactions to complete before a new job is added to the queue (assuming the SQL-based
|
|
// transactions to complete before a new job is added to the queue (assuming the SQL-based
|
|
|
// JobQueueStrategy).
|
|
// JobQueueStrategy).
|
|
|
|
|
+ // TODO: should be able to remove owing to f0fd6625
|
|
|
.pipe(delay(1))
|
|
.pipe(delay(1))
|
|
|
.subscribe(event => {
|
|
.subscribe(event => {
|
|
|
const defaultTaxZone = event.ctx.channel.defaultTaxZone;
|
|
const defaultTaxZone = event.ctx.channel.defaultTaxZone;
|