From 5074184ed84db68672c517c2bbede3f98f183e4c Mon Sep 17 00:00:00 2001 From: Henry Fontanier Date: Fri, 5 Apr 2024 11:13:21 +0200 Subject: [PATCH] fix: don't prod check paused connectors (#4582) Co-authored-by: Henry Fontanier --- .../checks/check_active_workflows_for_connectors.ts | 10 +++++++--- .../checks/check_notion_active_workflows.ts | 6 +++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/front/production_checks/checks/check_active_workflows_for_connectors.ts b/front/production_checks/checks/check_active_workflows_for_connectors.ts index f519c3c74863..a11b7494794d 100644 --- a/front/production_checks/checks/check_active_workflows_for_connectors.ts +++ b/front/production_checks/checks/check_active_workflows_for_connectors.ts @@ -1,7 +1,7 @@ +import type { ConnectorProvider } from "@dust-tt/types"; import { - makeConfluenceSyncWorkflowId, - type ConnectorProvider, getIntercomSyncWorkflowId, + makeConfluenceSyncWorkflowId, } from "@dust-tt/types"; import type { Client, WorkflowHandle } from "@temporalio/client"; import { QueryTypes } from "sequelize"; @@ -14,6 +14,7 @@ interface ConnectorBlob { id: number; dataSourceName: string; workspaceId: string; + pausedAt: Date | null; } interface ProviderCheck { @@ -35,7 +36,7 @@ const providersToCheck: Partial> = { async function listAllConnectorsForProvider(provider: ConnectorProvider) { const connectors: ConnectorBlob[] = await connectorsReplica.query( - `SELECT id, "dataSourceName", "workspaceId" FROM connectors WHERE "type" = :provider and "errorType" IS NULL`, + `SELECT id, "dataSourceName", "workspaceId", "pausedAt" FROM connectors WHERE "type" = :provider and "errorType" IS NULL`, { type: QueryTypes.SELECT, replacements: { @@ -83,6 +84,9 @@ export const checkActiveWorkflows: CheckFunction = async ( const missingActiveWorkflows: any[] = []; for (const connector of connectors) { + if (connector.pausedAt) { + continue; + } heartbeat(); const isActive = await areTemporalWorkflowsRunning( diff --git a/front/production_checks/checks/check_notion_active_workflows.ts b/front/production_checks/checks/check_notion_active_workflows.ts index 76c02ad82b37..33c9c7b47a76 100644 --- a/front/production_checks/checks/check_notion_active_workflows.ts +++ b/front/production_checks/checks/check_notion_active_workflows.ts @@ -10,13 +10,14 @@ interface NotionConnector { id: number; dataSourceName: string; workspaceId: string; + pausedAt: Date | null; } async function listAllNotionConnectors() { const connectorsReplica = getConnectorReplicaDbConnection(); const notionConnectors: NotionConnector[] = await connectorsReplica.query( - `SELECT id, "dataSourceName", "workspaceId" FROM connectors WHERE "type" = 'notion' and "errorType" IS NULL`, + `SELECT id, "dataSourceName", "workspaceId", "pausedAt" FROM connectors WHERE "type" = 'notion' and "errorType" IS NULL`, { type: QueryTypes.SELECT, } @@ -63,6 +64,9 @@ export const checkNotionActiveWorkflows: CheckFunction = async ( const missingActiveWorkflows: any[] = []; for (const notionConnector of notionConnectors) { + if (notionConnector.pausedAt) { + continue; + } heartbeat(); const isActive = await areTemporalWorkflowsRunning(client, notionConnector);