From ea19816148103b0e51d6f6db0191e5793847ab96 Mon Sep 17 00:00:00 2001 From: Jimmy Ma Date: Thu, 22 Dec 2022 11:12:26 -0800 Subject: [PATCH 1/2] Only add definitions updater cron when enabled --- .../java/io/airbyte/cron/selfhealing/DefinitionsUpdater.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/airbyte-cron/src/main/java/io/airbyte/cron/selfhealing/DefinitionsUpdater.java b/airbyte-cron/src/main/java/io/airbyte/cron/selfhealing/DefinitionsUpdater.java index 07878041088d..6cea66d076e0 100644 --- a/airbyte-cron/src/main/java/io/airbyte/cron/selfhealing/DefinitionsUpdater.java +++ b/airbyte-cron/src/main/java/io/airbyte/cron/selfhealing/DefinitionsUpdater.java @@ -11,6 +11,7 @@ import io.airbyte.config.init.ApplyDefinitionsHelper; import io.airbyte.config.init.RemoteDefinitionsProvider; import io.airbyte.config.persistence.ConfigRepository; +import io.micronaut.context.annotation.Requires; import io.micronaut.context.annotation.Value; import io.micronaut.scheduling.annotation.Scheduled; import jakarta.inject.Singleton; @@ -25,6 +26,8 @@ */ @Singleton @Slf4j +@Requires(property = "airbyte.cron.update-definitions.enabled", + value = "true") public class DefinitionsUpdater { private final ConfigRepository configRepository; From b3b0e7f526774d21c17094919041d9af4a960e07 Mon Sep 17 00:00:00 2001 From: Jimmy Ma Date: Thu, 22 Dec 2022 11:21:43 -0800 Subject: [PATCH 2/2] Remove unused property --- .../airbyte/cron/selfhealing/DefinitionsUpdater.java | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/airbyte-cron/src/main/java/io/airbyte/cron/selfhealing/DefinitionsUpdater.java b/airbyte-cron/src/main/java/io/airbyte/cron/selfhealing/DefinitionsUpdater.java index 6cea66d076e0..d4772c830edd 100644 --- a/airbyte-cron/src/main/java/io/airbyte/cron/selfhealing/DefinitionsUpdater.java +++ b/airbyte-cron/src/main/java/io/airbyte/cron/selfhealing/DefinitionsUpdater.java @@ -32,32 +32,23 @@ public class DefinitionsUpdater { private final ConfigRepository configRepository; - private final boolean shouldUpdateDefinitions; - private final URI remoteCatalogUrl; private final DeploymentMode deploymentMode; public DefinitionsUpdater(final ConfigRepository configRepository, final DeploymentMode deploymentMode, - @Value("${airbyte.remote-connector-catalog-url}") final String remoteCatalogUrl, - @Value("${airbyte.cron.update-definitions.enabled}") final boolean shouldUpdateDefinitions) { + @Value("${airbyte.remote-connector-catalog-url}") final String remoteCatalogUrl) { log.info("Creating connector definitions updater"); this.configRepository = configRepository; this.deploymentMode = deploymentMode; this.remoteCatalogUrl = remoteCatalogUrl != null ? URI.create(remoteCatalogUrl) : null; - this.shouldUpdateDefinitions = shouldUpdateDefinitions; } @Trace(operationName = SCHEDULED_TRACE_OPERATION_NAME) @Scheduled(fixedRate = "30s", initialDelay = "1m") void updateDefinitions() { - if (!shouldUpdateDefinitions) { - log.info("Connector definitions update disabled."); - return; - } - if (remoteCatalogUrl == null) { log.warn("Tried to update definitions, but the remote catalog url is not set"); return;