The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
fix(billing) - skip redundant cap writes (#20882)
Etienne50c8834e21d4
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.tsindex 973077da5e8..6000bf8ad3a 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@@ -317,7 +317,10 @@ export class BillingUsageService {-usedCredits,);- if (decrementedAvailableCredits <= 0) {+ const hasJustReachedCap =+ availableCredits > 0 && decrementedAvailableCredits <= 0;++ if (hasJustReachedCap) {await this.billingUsageCapService.setSubscriptionItemHasReachedCap(workspaceId,true,