From f7e94f0e0afd264fad749db42071ca43ec3c8e60 Mon Sep 17 00:00:00 2001 From: Alessandro Kreslin Date: Wed, 22 Jan 2025 14:01:49 -0500 Subject: [PATCH 1/2] feat: feature flag for feed status (#892) --- web-app/src/app/interface/RemoteConfig.ts | 2 ++ web-app/src/app/screens/Feed/DataQualitySummary.tsx | 6 +++++- web-app/src/app/screens/Feed/Feed.spec.tsx | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/web-app/src/app/interface/RemoteConfig.ts b/web-app/src/app/interface/RemoteConfig.ts index c6fabf030..82b7cc635 100644 --- a/web-app/src/app/interface/RemoteConfig.ts +++ b/web-app/src/app/interface/RemoteConfig.ts @@ -30,6 +30,7 @@ export interface RemoteConfigValues extends FirebaseDefaultConfig { featureFlagBypass: string; enableFeatureFilterSearch: boolean; enableIsOfficialFilterSearch: boolean; + enableFeedStatusBadge: boolean; } const featureByPassDefault: BypassConfig = { @@ -50,6 +51,7 @@ export const defaultRemoteConfigValues: RemoteConfigValues = { featureFlagBypass: JSON.stringify(featureByPassDefault), enableFeatureFilterSearch: false, enableIsOfficialFilterSearch: false, + enableFeedStatusBadge: false, }; remoteConfig.defaultConfig = defaultRemoteConfigValues; diff --git a/web-app/src/app/screens/Feed/DataQualitySummary.tsx b/web-app/src/app/screens/Feed/DataQualitySummary.tsx index eec07a3f9..d14bb02e7 100644 --- a/web-app/src/app/screens/Feed/DataQualitySummary.tsx +++ b/web-app/src/app/screens/Feed/DataQualitySummary.tsx @@ -8,6 +8,7 @@ import VerifiedIcon from '@mui/icons-material/Verified'; import { useTranslation } from 'react-i18next'; import { verificationBadgeStyle } from '../../styles/VerificationBadge.styles'; import { FeedStatusChip } from '../../components/FeedStatus'; +import { useRemoteConfig } from '../../context/RemoteConfigProvider'; export interface DataQualitySummaryProps { feedStatus: components['schemas']['BasicFeed']['status']; @@ -21,6 +22,7 @@ export default function DataQualitySummary({ latestDataset, }: DataQualitySummaryProps): React.ReactElement { const { t } = useTranslation('feeds'); + const { config } = useRemoteConfig(); return ( {(latestDataset?.validation_report === undefined || @@ -28,7 +30,9 @@ export default function DataQualitySummary({ {t('errorLoadingQualityReport')} )} - + {config.enableFeedStatusBadge && ( + + )} {isOfficialFeed && ( ({ + initializeApp: jest.fn(), + remoteConfig: jest.fn(() => ({ + settings: { minimumFetchIntervalMillis: 3600000 }, + })), +})); + describe('Feed page', () => { afterEach(cleanup); From 8e7ae21f32c0d357b937ca0665d2a2c8b079daca Mon Sep 17 00:00:00 2001 From: David Gamez <1192523+davidgamez@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:51:00 -0500 Subject: [PATCH 2/2] fix: DB tunnel fails with high frequency (#893) --- scripts/tunnel-create.sh | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/scripts/tunnel-create.sh b/scripts/tunnel-create.sh index e71ae3c0c..9bb4def34 100755 --- a/scripts/tunnel-create.sh +++ b/scripts/tunnel-create.sh @@ -39,6 +39,8 @@ PORT="5432" TARGET_PORT="5432" TARGET_ACCOUNT="" DB_INSTANCE="" +RETRY_INTERVAL=5 +MAX_RETRIES=12 display_usage() { printf "\nThis script creates a SSH tunnel between the local machine and a GCP database using a GCP instance deployed in the same VPC." @@ -137,15 +139,21 @@ fi # Getting the first IP ip=$(echo $ips | sed "s/\['\([^']*\)'.*/\1/") -# Wait 15s to allow the machine to be up before creating the tunnel -echo "Sleeping for 15s..." -sleep 15 -echo "Compute engine should be ready to use now" - -# Creating SSH tunnel -ssh -o StrictHostKeyChecking=no -fN -L ${PORT}:${target_ip}:${TARGET_PORT} ${TARGET_ACCOUNT}@${ip} +# Creating SSH tunnel with retry mechanism +retry_count=0 +while [ $retry_count -lt $MAX_RETRIES ]; do + ssh -o StrictHostKeyChecking=no -fN -L ${PORT}:${target_ip}:${TARGET_PORT} ${TARGET_ACCOUNT}@${ip} + if [ $? -eq 0 ]; then + echo "SSH tunnel created successfully" + break + else + echo "Error creating SSH tunnel, retrying in ${RETRY_INTERVAL}s..." + sleep ${RETRY_INTERVAL} + retry_count=$((retry_count + 1)) + fi +done -if [ $? -ne 0 ]; then - printf "\nError creating SSH tunnel\n" +if [ $retry_count -eq $MAX_RETRIES ]; then + printf "\nError creating SSH tunnel after ${MAX_RETRIES} attempts\n" exit 1 -fi \ No newline at end of file +fi