From c1cabac721d80f631875e00b26247b32e3f6e4da Mon Sep 17 00:00:00 2001 From: Florent Quienne <133488794+FlorentQuienne42@users.noreply.github.com> Date: Thu, 19 Oct 2023 15:43:17 +0200 Subject: [PATCH] fix(medusa): Dont set cache if `ignore_cache` option is true (#5408) * Dont 'set' in cache if ignore_cache option is true * Create big-countries-drive.md --------- Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com> --- .changeset/big-countries-drive.md | 5 +++++ packages/medusa/src/strategies/price-selection.ts | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/big-countries-drive.md diff --git a/.changeset/big-countries-drive.md b/.changeset/big-countries-drive.md new file mode 100644 index 0000000000..8484d58369 --- /dev/null +++ b/.changeset/big-countries-drive.md @@ -0,0 +1,5 @@ +--- +"@medusajs/medusa": patch +--- + +Dont 'set' in cache if ignore_cache option is true diff --git a/packages/medusa/src/strategies/price-selection.ts b/packages/medusa/src/strategies/price-selection.ts index e5a23fc820..d9c4eeefc4 100644 --- a/packages/medusa/src/strategies/price-selection.ts +++ b/packages/medusa/src/strategies/price-selection.ts @@ -96,7 +96,9 @@ class PriceSelectionStrategy extends AbstractPriceSelectionStrategy { await Promise.all( [...results].map(async ([variantId, prices]) => { variantPricesMap.set(variantId, prices) - await this.cacheService_.set(cacheKeysMap.get(variantId)!, prices) + if (!context.ignore_cache) { + await this.cacheService_.set(cacheKeysMap.get(variantId)!, prices) + } }) )