Skip to content

Commit

Permalink
Merge pull request #127 from RailgunCat/fix_config_reloading
Browse files Browse the repository at this point in the history
Fix config reloading
  • Loading branch information
rudibatt authored Dec 13, 2024
2 parents afb7998 + 8cd3d07 commit 9f9025f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions search-service/src/main/java/de/cxp/ocs/SearchController.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.context.refresh.ContextRefresher;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.EnableScheduling;
Expand Down Expand Up @@ -69,6 +70,9 @@ public class SearchController implements SearchService {
@Autowired
private MeterRegistry registry;

@Autowired
private ContextRefresher contextRefresher;

private final Map<String, SearchContext> searchContexts = new ConcurrentHashMap<>();

private final Map<String, String> actualIndexPerTenant = new ConcurrentHashMap<>();
Expand All @@ -85,6 +89,7 @@ public class SearchController implements SearchService {

@Scheduled(fixedDelayString = "${ocs.scheduler.refresh-config-delay-ms:60000}")
public void refreshAllConfigs() {
contextRefresher.refresh();
Set<String> loadedTenants = new HashSet<>(searchContexts.keySet());
if (loadedTenants.size() > 0) {
log.info("Refreshing {} loaded tenants: {}", loadedTenants.size(), loadedTenants);
Expand Down
2 changes: 1 addition & 1 deletion search-service/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<configuration>

<property resource="boostrap.properties" />
<property resource="bootstrap.properties" />
<contextName>${spring.application.name}</contextName>

<!-- "This makes it reasonable for real-world applications to use the jul-to-slf4j
Expand Down

0 comments on commit 9f9025f

Please sign in to comment.