From f71dacf9ac6e04334b4f3b9b476137e3d880a0fe Mon Sep 17 00:00:00 2001 From: Joana Maia Date: Fri, 26 Jun 2026 18:40:05 +0100 Subject: [PATCH 1/2] fix: disconnect gitlab Signed-off-by: Joana Maia --- backend/src/services/integrationService.ts | 23 +++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/backend/src/services/integrationService.ts b/backend/src/services/integrationService.ts index 2ff1365a15..f63df08322 100644 --- a/backend/src/services/integrationService.ts +++ b/backend/src/services/integrationService.ts @@ -315,6 +315,11 @@ export default class IntegrationService { async destroyAll(ids) { const toRemoveRepo = new Set() let segmentId + // Collect GitLab webhook info before opening the transaction so external HTTP calls + // don't hold the DB connection idle long enough to trigger a connection timeout. + const gitlabWebhookRemovals: Array<{ token: string; projectIds: number[]; hookIds: number[] }> = + [] + const transaction = await SequelizeRepository.createTransaction(this.options) try { @@ -446,11 +451,11 @@ export default class IntegrationService { } if (integration.platform === PlatformType.GITLAB && integration.settings.webhooks) { - await removeGitlabWebhooks( - integration.token, - integration.settings.webhooks.map((hook) => hook.projectId), - integration.settings.webhooks.map((hook) => hook.hookId), - ) + gitlabWebhookRemovals.push({ + token: integration.token, + projectIds: integration.settings.webhooks.map((hook) => hook.projectId), + hookIds: integration.settings.webhooks.map((hook) => hook.hookId), + }) } if (integration.platform === PlatformType.GIT) { @@ -495,6 +500,14 @@ export default class IntegrationService { await SequelizeRepository.rollbackTransaction(transaction) throw error } + + // Remove GitLab webhooks after the transaction commits — these are external HTTP calls + // and must not hold a DB connection open. + await Promise.all( + gitlabWebhookRemovals.map(({ token, projectIds, hookIds }) => + removeGitlabWebhooks(token, projectIds, hookIds), + ), + ) } async findById(id) { From e3ccff532e62923a6a3514845e8d75666abac433 Mon Sep 17 00:00:00 2001 From: Joana Maia Date: Fri, 26 Jun 2026 22:55:15 +0100 Subject: [PATCH 2/2] fix: include merge_request-review-approved in PR analysis tinybird pipes Co-Authored-By: Claude Sonnet 4.6 Signed-off-by: Joana Maia --- .../pull_request_analysis_baseline_merge_MV.pipe | 12 ++++++++++-- .../pull_request_analysis_initial_snapshot.pipe | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/services/libs/tinybird/pipes/pull_request_analysis_baseline_merge_MV.pipe b/services/libs/tinybird/pipes/pull_request_analysis_baseline_merge_MV.pipe index e9608a0f17..f8d33f6fa2 100644 --- a/services/libs/tinybird/pipes/pull_request_analysis_baseline_merge_MV.pipe +++ b/services/libs/tinybird/pipes/pull_request_analysis_baseline_merge_MV.pipe @@ -115,7 +115,11 @@ SQL > argMin( updatedAt, if( - type IN ('pull_request-reviewed', 'merge_request-review-changes-requested') + type IN ( + 'pull_request-reviewed', + 'merge_request-review-changes-requested', + 'merge_request-review-approved' + ) OR ( type = 'patchset_approval-created' AND splitByChar('-', sourceParentId)[1] = prSourceId @@ -126,7 +130,11 @@ SQL > ) AS reviewedUpdatedAt, min( if( - type IN ('pull_request-reviewed', 'merge_request-review-changes-requested') + type IN ( + 'pull_request-reviewed', + 'merge_request-review-changes-requested', + 'merge_request-review-approved' + ) OR ( type = 'patchset_approval-created' AND splitByChar('-', sourceParentId)[1] = prSourceId diff --git a/services/libs/tinybird/pipes/pull_request_analysis_initial_snapshot.pipe b/services/libs/tinybird/pipes/pull_request_analysis_initial_snapshot.pipe index e115562065..b5ffe50676 100644 --- a/services/libs/tinybird/pipes/pull_request_analysis_initial_snapshot.pipe +++ b/services/libs/tinybird/pipes/pull_request_analysis_initial_snapshot.pipe @@ -98,6 +98,7 @@ SQL > and ( type = 'pull_request-reviewed' OR type = 'merge_request-review-changes-requested' + OR type = 'merge_request-review-approved' OR type = 'patchset_approval-created' ) {% if defined(bucket_id) %}