mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: racing conditions
This commit is contained in:
@@ -185,7 +185,10 @@ export function checkForTrialEnding(org: Organization) {
|
||||
}
|
||||
|
||||
export function checkForUsageLimit(org: Organization) {
|
||||
if (org?.billingLimits) return;
|
||||
if (!org?.billingLimits) {
|
||||
readOnly.set(false);
|
||||
return;
|
||||
}
|
||||
const { bandwidth, documents, executions, storage, users } = org.billingLimits;
|
||||
if (
|
||||
bandwidth >= 100 ||
|
||||
@@ -195,7 +198,7 @@ export function checkForUsageLimit(org: Organization) {
|
||||
users >= 100
|
||||
) {
|
||||
readOnly.set(true);
|
||||
}
|
||||
} else readOnly.set(false);
|
||||
}
|
||||
|
||||
export async function checkPaymentAuthorizationRequired(org: Organization) {
|
||||
|
||||
@@ -292,12 +292,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
let currentOrg = JSON.stringify($organization?.$id);
|
||||
|
||||
organization.subscribe(async (org) => {
|
||||
if (!org) return;
|
||||
if (currentOrg === org.$id) return;
|
||||
currentOrg = org.$id;
|
||||
if (isCloud) {
|
||||
calculateTrialDay(org);
|
||||
checkForTrialEnding(org);
|
||||
|
||||
Reference in New Issue
Block a user