The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Filter connected account webhook renewal to exclude accounts with failed authentication errors (#23694)
neo7737c797ff0c9cc
diff --git a/packages/twenty-server/src/modules/connected-account/webhook-subscription-manager/crons/jobs/webhook-subscription-renewal.cron.job.ts b/packages/twenty-server/src/modules/connected-account/webhook-subscription-manager/crons/jobs/webhook-subscription-renewal.cron.job.tsindex e2ab20205c9..f95b0865ea4 100644--- a/packages/twenty-server/src/modules/connected-account/webhook-subscription-manager/crons/jobs/webhook-subscription-renewal.cron.job.ts+++ b/packages/twenty-server/src/modules/connected-account/webhook-subscription-manager/crons/jobs/webhook-subscription-renewal.cron.job.ts@@ -6,7 +6,13 @@ import {WebhookSubscriptionStatus,} from 'twenty-shared/types';import { WorkspaceActivationStatus } from 'twenty-shared/workspace';-import { type FindManyOptions, In, LessThanOrEqual, Repository } from 'typeorm';+import {+ type FindManyOptions,+ In,+ IsNull,+ LessThanOrEqual,+ Repository,+} from 'typeorm';import { SentryCronMonitor } from 'src/engine/core-modules/cron/sentry-cron-monitor.decorator';import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator';@@ -94,7 +100,10 @@ export class WebhookSubscriptionRenewalCronJob {repository: Repository<TChannel>,activeWorkspaceIds: string[],): Promise<StaleChannel[]> {- const workspaceScope = { workspaceId: In(activeWorkspaceIds) };+ const workspaceScope = {+ workspaceId: In(activeWorkspaceIds),+ connectedAccount: { authFailedAt: IsNull() },+ };const renewalThreshold = new Date(Date.now() + WEBHOOK_SUBSCRIPTION_RENEWAL_BUFFER_MS,);