commercetools / commercetools/commercetools-sync-java

When using ProductSync with multiple ProductDrafts that reference product types, the library may issue multiple duplicate requests to fetch all product types.

未关闭
#1,228 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Java
星标
40
派生
41
PR 合并指标
30 天内没有已合并 PR

描述

**Describe the bug**
ProductTypeServiceImpl.fetchCachedProductAttributeMetaDataMap(productTypeId) checks:

`if (productsAttributesMetaData.isEmpty()) {
return fetchAndCacheProductMetaData(productTypeId);
}
`
On the very first calls, the cache is still empty.
Each concurrent (or even sequential but fast) call triggers its own QueryUtils.queryAll(...).
Because the caching happens asynchronously, subsequent calls still see the cache as empty until the first queryAll finishes.
As a result, multiple identical full queries for product types are executed.

**To Reproduce**
Steps to reproduce the behavior:
Call sync with multiple ProductDrafts that reference product types

**Expected behavior**
The first call should trigger one asynchronous cache warm-up.
All subsequent calls (while the warm-up is in progress) should wait for the same future instead of starting new queries.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。