Skip to content
This repository has been archived by the owner on May 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #585 from vuestorefront/hotfix/v1.12.5
Browse files Browse the repository at this point in the history
Release - Hotfix/v1.12.5
  • Loading branch information
Fifciu authored Nov 2, 2021
2 parents eefe4ef + e7a5fbd commit c394334
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 23 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.12.5] - 2021.11.02

### Fixed
- Fix caching of attributes. They were missing cache tag, preventing them from being purged correctly and also not separated cache key between multi stores (#583)

## [1.12.4] - 2021.01.15

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-storefront-api",
"version": "1.12.4",
"version": "1.12.5",
"private": true,
"description": "vue-storefront API and data services",
"main": "dist",
Expand Down
15 changes: 8 additions & 7 deletions src/api/attribute/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ function transformAggsToAttributeListParam (aggregations): AttributeListParam {
/**
* Returns attributes from cache
*/
async function getAttributeFromCache (attributeCode: string, config) {
async function getAttributeFromCache (attributeCode: string, config, indexName) {
if (config.server.useOutputCache && cache) {
try {
const res = await (cache as TagCache).get(
'api:attribute-list' + attributeCode
'api:' + indexName + ':attribute-list:' + attributeCode
)
return res
} catch (err) {
Expand All @@ -56,13 +56,14 @@ async function getAttributeFromCache (attributeCode: string, config) {
/**
* Save attributes in cache
*/
async function setAttributeInCache (attributeList, config) {
async function setAttributeInCache (attributeList, config, indexName) {
if (config.server.useOutputCache && cache) {
try {
await Promise.all(
attributeList.map(attribute => (cache as TagCache).set(
'api:attribute-list' + attribute.attribute_code,
attribute
'api:' + indexName + ':attribute-list:' + attribute.attribute_code,
attribute,
['attribute']
))
)
} catch (err) {
Expand Down Expand Up @@ -90,7 +91,7 @@ async function list (attributesParam: AttributeListParam, config, indexName: str

// here we check if some of attribute are in cache
const rawCachedAttributeList = await Promise.all(
attributeCodes.map(attributeCode => getAttributeFromCache(attributeCode, config))
attributeCodes.map(attributeCode => getAttributeFromCache(attributeCode, config, indexName))
)

const cachedAttributeList = rawCachedAttributeList
Expand Down Expand Up @@ -125,7 +126,7 @@ async function list (attributesParam: AttributeListParam, config, indexName: str
const fetchedAttributeList = get(response.body, 'hits.hits', []).map(hit => hit._source)

// save atrributes in cache
await setAttributeInCache(fetchedAttributeList, config)
await setAttributeInCache(fetchedAttributeList, config, indexName)

// cached and fetched attributes
const allAttributes = [
Expand Down
30 changes: 15 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4415,9 +4415,9 @@ lru-cache@^5.0.0:
dependencies:
yallist "^3.0.2"

"mage2vuestorefront@git+https://github.com/DivanteLtd/mage2vuestorefront.git":
version "1.11.0"
resolved "git+https://github.com/DivanteLtd/mage2vuestorefront.git#6b477d35b6d11f935b1643938881969f16c87c04"
"mage2vuestorefront@git+https://github.com/vuestorefront/mage2vuestorefront.git":
version "1.11.1"
resolved "git+https://github.com/vuestorefront/mage2vuestorefront.git#a2abf48ec40d9fb761ee3f5117a1c87dc7f7c0c6"
dependencies:
"@elastic/elasticsearch" "^7.3.0"
agentkeepalive "^3.3.0"
Expand All @@ -4428,8 +4428,8 @@ lru-cache@^5.0.0:
jsonfile "^4.0.0"
jwt-simple "^0.5.1"
kue "^0.11.5"
lodash "^4.17.13"
magento2-rest-client "0.0.2"
lodash "^4.17.19"
magento2-rest-client "https://github.com/DivanteLtd/magento2-rest-client"
moment "^2.22.2"
node-sync "^0.2.1"
passport "^0.3.2"
Expand All @@ -4449,19 +4449,19 @@ lru-cache@^5.0.0:
request "^2.72.0"
winston "^2.2.0"

magento2-rest-client@0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/magento2-rest-client/-/magento2-rest-client-0.0.2.tgz#2a6ef230c88129a8680b63ead3793ea7e99bf6a4"
integrity sha1-Km7yMMiBKahoC2Pq03k+p+mb9qQ=
"magento2-rest-client@github:vuestorefront/magento2-rest-client":
version "0.0.14"
uid "3ed81008e617abfed347ed42fb52ac9d72c8705b"
resolved "https://codeload.github.com/vuestorefront/magento2-rest-client/tar.gz/3ed81008e617abfed347ed42fb52ac9d72c8705b"
dependencies:
humps "^1.1.0"
oauth-1.0a "^1.0.1"
request "^2.72.0"
winston "^2.2.0"

"magento2-rest-client@github:DivanteLtd/magento2-rest-client":
version "0.0.12"
resolved "https://codeload.github.com/DivanteLtd/magento2-rest-client/tar.gz/fb5adcb24fe25e097c2127a3ded5ef05e0fcb2f7"
"magento2-rest-client@https://github.com/DivanteLtd/magento2-rest-client":
version "0.0.14"
resolved "https://github.com/DivanteLtd/magento2-rest-client#3ed81008e617abfed347ed42fb52ac9d72c8705b"
dependencies:
humps "^1.1.0"
oauth-1.0a "^1.0.1"
Expand Down Expand Up @@ -6694,9 +6694,9 @@ stealthy-require@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b"

"storefront-query-builder@https://github.com/DivanteLtd/storefront-query-builder.git":
version "1.0.1"
resolved "https://github.com/DivanteLtd/storefront-query-builder.git#0ef1f9760eb44edce5b9464a9145ce0a7517a419"
"storefront-query-builder@https://github.com/vuestorefront/storefront-query-builder.git":
version "1.0.2"
resolved "https://github.com/vuestorefront/storefront-query-builder.git#7416993f07927f598d22ca448462f0d3f0288f20"
dependencies:
"@typescript-eslint/parser" "^2.26.0"
clone-deep "^4.0.1"
Expand Down

0 comments on commit c394334

Please sign in to comment.