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.
- Ngôn ngữ chính
- Java
- Star
- 40
- Fork
- 41
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
**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.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu tại ProductTypeServiceImpl.fetchCachedProductAttributeMetaDataMap(productTypeId) và lần theo fetchAndCacheProductMetaData cùng QueryUtils.queryAll. Tái hiện bằng ProductSync và nhiều ProductDrafts tham chiếu đến các loại sản phẩm; hoàn tất khi một lần làm nóng cache không đồng bộ được các lần gọi tiếp theo dùng chung, thay vì phát hành các truy vấn đầy đủ trùng lặp.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- backend
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 52/100