diff --git a/packages/chronos/chronos.ts b/packages/chronos/chronos.ts index 2a8b255878c..2ac79da82fa 100644 --- a/packages/chronos/chronos.ts +++ b/packages/chronos/chronos.ts @@ -102,16 +102,16 @@ const chronos = () => { processRecurrence: { onTick: () => { const query = ` - mutation ProcessRecurrence{ - processRecurrence{ - ... on ProcessRecurrenceSuccess { - meetingsStarted - meetingsEnded + mutation ProcessRecurrence { + processRecurrence{ + ... on ProcessRecurrenceSuccess { + meetingsStarted + meetingsEnded + } } } - } - ` - publishWebhookGQL(query, {}) + ` + publishWebhookGQL(query, {}, {longRunning: true}) }, cronTime: CHRONOS_PROCESS_RECURRENCE } diff --git a/packages/server/utils/PubSubPromise.ts b/packages/server/utils/PubSubPromise.ts index cd95cbaf325..de0452ac3f1 100644 --- a/packages/server/utils/PubSubPromise.ts +++ b/packages/server/utils/PubSubPromise.ts @@ -5,6 +5,7 @@ import numToBase64 from './numToBase64' import sendToSentry from './sendToSentry' const STANDARD_TIMEOUT = ms('10s') +const LONG_TIMEOUT = ms('60s') const ADHOC_TIMEOUT = ms('10m') interface Job { @@ -17,6 +18,7 @@ const {SERVER_ID} = process.env interface BaseRequest { executorServerId?: string isAdHoc?: boolean + longRunning?: boolean } export default class PubSubPromise { @@ -51,8 +53,8 @@ export default class PubSubPromise { return new Promise((resolve, reject) => { const nextJob = numToBase64(this.jobCounter++) const jobId = `${SERVER_ID}:${nextJob}` - const {isAdHoc} = request - const timeout = isAdHoc ? ADHOC_TIMEOUT : STANDARD_TIMEOUT + const {isAdHoc, longRunning} = request + const timeout = isAdHoc ? ADHOC_TIMEOUT : longRunning ? LONG_TIMEOUT : STANDARD_TIMEOUT const timeoutId = setTimeout(() => { delete this.jobs[jobId] reject(new Error('TIMEOUT')) diff --git a/packages/server/utils/publishWebhookGQL.ts b/packages/server/utils/publishWebhookGQL.ts index 609f3dd2bc0..4c10f861604 100644 --- a/packages/server/utils/publishWebhookGQL.ts +++ b/packages/server/utils/publishWebhookGQL.ts @@ -3,13 +3,18 @@ import ServerAuthToken from '../database/types/ServerAuthToken' import getGraphQLExecutor from './getGraphQLExecutor' import sendToSentry from './sendToSentry' -const publishWebhookGQL = async (query: string, variables: Variables) => { +interface PublishOptions { + longRunning?: boolean +} + +const publishWebhookGQL = async (query: string, variables: Variables, options?: PublishOptions) => { try { return await getGraphQLExecutor().publish({ authToken: new ServerAuthToken(), query, variables, - isPrivate: true + isPrivate: true, + ...options }) } catch (e) { const error = e instanceof Error ? e : new Error('GQL executor failed to publish')