From fc74938d7b608812e69c37f86cfc9e760fc71f6e Mon Sep 17 00:00:00 2001 From: Etienne <45695613+etiennejouan@users.noreply.github.com> Date: Mon, 18 May 2026 14:29:47 +0200 Subject: [PATCH] fix(billing) - query timeout (#20669) Sonarly context : https://sonarly.com/issue/33412 Sentry issue : https://twenty-v7.sentry.io/issues/7454613767/?project=4507072499810304 --- .../billing/services/billing-usage.service.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/twenty-server/src/engine/core-modules/billing/services/billing-usage.service.ts b/packages/twenty-server/src/engine/core-modules/billing/services/billing-usage.service.ts index a4f8c57770..973077da5e 100644 --- a/packages/twenty-server/src/engine/core-modules/billing/services/billing-usage.service.ts +++ b/packages/twenty-server/src/engine/core-modules/billing/services/billing-usage.service.ts @@ -56,12 +56,15 @@ export class BillingUsageService { return true; } - const billingSubscription = - await this.billingSubscriptionService.getCurrentBillingSubscription({ - workspaceId, - }); + const { billingSubscription } = + await this.workspaceCacheService.getOrRecompute(workspaceId, [ + 'billingSubscription', + ]); - return !!billingSubscription; + return ( + isDefined(billingSubscription) && + billingSubscription.status !== SubscriptionStatus.Canceled + ); } async getResourceCreditProductUsage(