Skip to content

Commit 97a6744

Browse files
committed
feat:support config empty protection.
1 parent e9dbda8 commit 97a6744

File tree

1 file changed

+8
-0
lines changed
  • polaris-configuration/polaris-configuration-client/src/main/java/com/tencent/polaris/configuration/client/internal

1 file changed

+8
-0
lines changed

polaris-configuration/polaris-configuration-client/src/main/java/com/tencent/polaris/configuration/client/internal/RemoteConfigFileRepo.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ protected void doPull() {
192192
}
193193
if (shouldUpdateLocalCache) {
194194
runnable.run();
195+
cancelEmptyProtectionExpireTask();
195196
}
196197
return;
197198
}
@@ -344,6 +345,13 @@ private void submitEmptyProtectionExpireTask(Runnable runnable) {
344345
}
345346
}
346347

348+
private void cancelEmptyProtectionExpireTask() {
349+
if (emptyProtectionExpireFuture != null && !emptyProtectionExpireFuture.isCancelled() && !emptyProtectionExpireFuture.isDone()) {
350+
emptyProtectionExpireFuture.cancel(true);
351+
LOGGER.info("Empty protection expire task of {} cancel.", getIdentifier());
352+
}
353+
}
354+
347355
@JustForTest
348356
String getIdentifier() {
349357
return configFileMetadata.getNamespace() + "."

0 commit comments

Comments
 (0)