Skip to content

Commit

Permalink
fix(browse): Fix issue with old browse config being used (#711)
Browse files Browse the repository at this point in the history
* fix(browse): Remove browse config caching

- Remove the caching to fix issue with old browse config being used

Closes: MSEARCH-897

(cherry picked from commit b7dc56f)
  • Loading branch information
viacheslavkol committed Dec 12, 2024
1 parent 8c2c388 commit 74ecd77
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 10 deletions.
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v4.0.3 2024-12-12
### Bug fixes
* Remove browse config caching ([MSEARCH-897](https://folio-org.atlassian.net/browse/MSEARCH-897))

---

## v4.0.2 2024-12-06
### Features
* Move Instance sub-entities population from database trigger to code ([MSEARCH-887](https://folio-org.atlassian.net/browse/MSEARCH-887))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public class SearchCacheNames {

public static final String ES_INDICES_CACHE = "es-indices";
public static final String REFERENCE_DATA_CACHE = "reference-data-cache";
public static final String BROWSE_CONFIG_CACHE = "browse-config-cache";
public static final String RESOURCE_LANGUAGE_CACHE = "tenant-languages";
public static final String TENANT_FEATURES_CACHE = "tenant-features";
public static final String SEARCH_PREFERENCE_CACHE = "search-preference";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.folio.search.service.config;

import static org.folio.search.client.InventoryReferenceDataClient.ReferenceDataType.CLASSIFICATION_TYPES;
import static org.folio.search.configuration.SearchCacheNames.BROWSE_CONFIG_CACHE;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -23,8 +22,6 @@
import org.folio.search.model.config.BrowseConfigId;
import org.folio.search.repository.BrowseConfigEntityRepository;
import org.folio.search.utils.CollectionUtils;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

Expand All @@ -45,8 +42,6 @@ public BrowseConfigCollection getConfigs(@NonNull BrowseType type) {
return mapper.convert(repository.findByConfigId_BrowseType(type.getValue()));
}

@Cacheable(cacheNames = BROWSE_CONFIG_CACHE,
key = "@folioExecutionContext.tenantId + ':' + #type.value + ':' + #optionType.value")
public BrowseConfig getConfig(@NonNull BrowseType type, @NonNull BrowseOptionType optionType) {
var typeValue = type.getValue();
var optionTypeValue = optionType.getValue();
Expand All @@ -58,7 +53,6 @@ public BrowseConfig getConfig(@NonNull BrowseType type, @NonNull BrowseOptionTyp
"Config for %s type %s must be present in database".formatted(typeValue, optionTypeValue)));
}

@CacheEvict(cacheNames = BROWSE_CONFIG_CACHE, allEntries = true)
public void upsertConfig(@NonNull BrowseType type,
@NonNull BrowseOptionType optionType,
@NonNull BrowseConfig config) {
Expand All @@ -72,7 +66,6 @@ public void upsertConfig(@NonNull BrowseType type,
}

@Transactional
@CacheEvict(cacheNames = BROWSE_CONFIG_CACHE, allEntries = true)
public void deleteTypeIdsFromConfigs(@NonNull BrowseType type, @NonNull List<String> typeIds) {
if (typeIds.isEmpty()) {
return;
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ spring:
cache-names:
- es-indices
- reference-data-cache
- browse-config-cache
- tenant-languages
- tenant-features
- search-preference
Expand Down
1 change: 0 additions & 1 deletion src/test/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ spring:
cache-names:
- es-indices
- reference-data-cache
- browse-config-cache
- tenant-languages
- tenant-features
- search-preference
Expand Down

0 comments on commit 74ecd77

Please sign in to comment.