From bbb9e27c3f023643597662d20988b7ab107310e3 Mon Sep 17 00:00:00 2001 From: Jimmy Ma Date: Mon, 5 Dec 2022 11:23:44 -0800 Subject: [PATCH] Add constant for fallback cases --- .../server/handlers/WebBackendCheckUpdatesHandler.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/airbyte-server/src/main/java/io/airbyte/server/handlers/WebBackendCheckUpdatesHandler.java b/airbyte-server/src/main/java/io/airbyte/server/handlers/WebBackendCheckUpdatesHandler.java index ad8f97ecd014..1884a8d39244 100644 --- a/airbyte-server/src/main/java/io/airbyte/server/handlers/WebBackendCheckUpdatesHandler.java +++ b/airbyte-server/src/main/java/io/airbyte/server/handlers/WebBackendCheckUpdatesHandler.java @@ -22,6 +22,8 @@ @Slf4j public class WebBackendCheckUpdatesHandler { + private static final int NO_CHANGES_FOUND = 0; + final ConfigRepository configRepository; final AirbyteGithubStore githubStore; @@ -46,7 +48,7 @@ private int getDestinationDiffCount() { .toList(); } catch (final IOException e) { log.error("Failed to get current list of standard destination definitions", e); - return 0; + return NO_CHANGES_FOUND; } try { @@ -55,7 +57,7 @@ private int getDestinationDiffCount() { .collect(Collectors.toMap(StandardDestinationDefinition::getDestinationDefinitionId, StandardDestinationDefinition::getDockerImageTag)); } catch (final InterruptedException e) { log.error("Failed to get latest list of standard destination definitions", e); - return 0; + return NO_CHANGES_FOUND; } return getDiffCount(currentActorDefToDockerImageTag, newActorDefToDockerImageTag); @@ -72,7 +74,7 @@ private int getSourceDiffCount() { .toList(); } catch (final IOException e) { log.error("Failed to get current list of standard source definitions", e); - return 0; + return NO_CHANGES_FOUND; } try { @@ -81,7 +83,7 @@ private int getSourceDiffCount() { .collect(Collectors.toMap(StandardSourceDefinition::getSourceDefinitionId, StandardSourceDefinition::getDockerImageTag)); } catch (final InterruptedException e) { log.error("Failed to get latest list of standard source definitions", e); - return 0; + return NO_CHANGES_FOUND; } return getDiffCount(currentActorDefToDockerImageTag, newActorDefToDockerImageTag);