Skip to content

The open alternative to Salesforce, designed for AI.

fix(billing) - query timeout (#20669)

Etiennefc74938d7b60
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 a4f8c57770d..973077da5e8 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(