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
  • Loading branch information
viacheslavkol authored Dec 11, 2024
1 parent 5d20850 commit b7dc56f
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 10 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* Change browse_config type_ids column type from varchar to array ([MSEARCH-890](https://folio-org.atlassian.net/browse/MSEARCH-890))
* Fix old browse config returned on get after upsert ([MSEARCH-897](https://folio-org.atlassian.net/browse/MSEARCH-897))
* Fix generation of IDs ranges in Reindex Upload for Subject, Classification and Contributor ([MSEARCH-907](https://folio-org.atlassian.net/browse/MSEARCH-907))
* Remove browse config caching ([MSEARCH-897](https://folio-org.atlassian.net/browse/MSEARCH-897))

### Tech Dept
* Description ([ISSUE](https://folio-org.atlassian.net/browse/ISSUE))
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 @@ -24,8 +23,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 @@ -46,8 +43,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 @@ -59,7 +54,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 @@ -73,7 +67,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 b7dc56f

Please sign in to comment.