From 1846bf25e06f187b30ff07728247df6a86c33748 Mon Sep 17 00:00:00 2001 From: petruki <31597636+petruki@users.noreply.github.com> Date: Sat, 15 Jun 2024 16:01:32 -0700 Subject: [PATCH 1/2] Added switcher-client scheduler logs - bump deps --- Dockerfile | 2 +- pom.xml | 14 +++++++------- .../switcherapi/ac/config/SwitcherConfig.java | 12 +++++++++++- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index c189e8c..4245dff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM maven:3.9.5-eclipse-temurin-21-alpine AS maven +FROM maven:3.9.7-eclipse-temurin-21-alpine AS maven WORKDIR /usr/src/app COPY . /usr/src/app diff --git a/pom.xml b/pom.xml index 7a1996c..ee111d3 100644 --- a/pom.xml +++ b/pom.xml @@ -50,7 +50,7 @@ org.springframework.boot spring-boot-starter-parent - 3.2.5 + 3.3.0 .. @@ -63,23 +63,23 @@ 2.0.7 0.12.5 2.12.7 - 2.10.1 + 2.11.0 2.5.0 - 4.12.2 + 4.14.0 2.2 - 10.1.23 + 10.1.24 1.5.6 - 2.17.0 + 2.17.1 2.9.0 2.5.1 - 1.26.1 + 1.26.2 - 3.12.1 + 3.13.0 3.10.0.2594 0.8.12 diff --git a/src/main/java/com/github/switcherapi/ac/config/SwitcherConfig.java b/src/main/java/com/github/switcherapi/ac/config/SwitcherConfig.java index 5f02fd7..f0291aa 100644 --- a/src/main/java/com/github/switcherapi/ac/config/SwitcherConfig.java +++ b/src/main/java/com/github/switcherapi/ac/config/SwitcherConfig.java @@ -2,15 +2,19 @@ import com.github.switcherapi.ac.util.FileUtil; import com.github.switcherapi.client.ContextBuilder; +import com.github.switcherapi.client.SnapshotCallback; import jakarta.annotation.PostConstruct; import lombok.Data; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; import static com.github.switcherapi.ac.config.SwitcherFeatures.configure; import static com.github.switcherapi.ac.config.SwitcherFeatures.initializeClient; +import static com.github.switcherapi.client.SwitcherContextBase.scheduleSnapshotAutoUpdate; +@Slf4j @Configuration @ConfigurationProperties(prefix = "switcher") @Data @@ -51,13 +55,19 @@ private void configureSwitcher() { .component(component) .local(local) .silentMode(silent) - .snapshotAutoUpdateInterval(snapshot.getAutoUpdateInterval()) .snapshotLocation(StringUtils.isNotBlank(snapshot.getLocation()) ? snapshot.getLocation() : null) .snapshotAutoLoad(snapshot.isAuto()) .truststorePath(StringUtils.isNotBlank(truststore.getPath()) ? FileUtil.getFilePathFromResource(truststore.getPath()) : null) .truststorePassword(StringUtils.isNotBlank(truststore.getPassword()) ? truststore.getPassword() : null) ); + scheduleSnapshotAutoUpdate(snapshot.getAutoUpdateInterval(), new SnapshotCallback() { + @Override + public void onSnapshotUpdate(long version) { + log.info("Snapshot updated: {}", version); + } + }); + initializeClient(); } From a8cd3f9afba3d42bc6908da3cae8ab2758ba6eb3 Mon Sep 17 00:00:00 2001 From: petruki <31597636+petruki@users.noreply.github.com> Date: Sat, 15 Jun 2024 16:04:57 -0700 Subject: [PATCH 2/2] chore: removed SwitcherConfig from coverage --- pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ee111d3..654c713 100644 --- a/pom.xml +++ b/pom.xml @@ -89,7 +89,8 @@ java **/model/**/*.java, - **/config/SwitcherFeatures.java + **/config/SwitcherFeatures.java, + **/config/SwitcherConfig.java,