Skip to content

Commit

Permalink
perf(core): Use request cache for hot-path tax rate calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Sep 28, 2021
1 parent fa563f2 commit 9e22e8b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/service/services/product-variant.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -592,10 +592,10 @@ export class ProductVariantService {
if (!activeTaxZone) {
throw new InternalServerError(`error.no-active-tax-zone`);
}
const applicableTaxRate = await this.taxRateService.getApplicableTaxRate(
const applicableTaxRate = await this.requestCache.get(
ctx,
activeTaxZone,
variant.taxCategory,
`applicableTaxRate-${activeTaxZone.id}-${variant.taxCategory.id}`,
() => this.taxRateService.getApplicableTaxRate(ctx, activeTaxZone, variant.taxCategory),
);

const { productVariantPriceCalculationStrategy } = this.configService.catalogOptions;
Expand Down

0 comments on commit 9e22e8b

Please sign in to comment.