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 件 担当者 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 を短くまとめたダイジェスト。