mirror of
https://github.com/fosrl/pangolin.git
synced 2026-09-01 16:59:22 +02:00
Update license.ts
This commit is contained in:
@@ -149,12 +149,8 @@ LQIDAQAB
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Count used sites and users for license comparison
|
// Count used sites and users for license comparison
|
||||||
const [siteCountRes] = await db
|
const [siteCountRes] = await db.select({ value: count() }).from(sites);
|
||||||
.select({ value: count() })
|
const [userCountRes] = await db.select({ value: count() }).from(users);
|
||||||
.from(sites);
|
|
||||||
const [userCountRes] = await db
|
|
||||||
.select({ value: count() })
|
|
||||||
.from(users);
|
|
||||||
|
|
||||||
const status: LicenseStatus = {
|
const status: LicenseStatus = {
|
||||||
hostId: this.hostMeta.hostMetaId,
|
hostId: this.hostMeta.hostMetaId,
|
||||||
@@ -277,9 +273,7 @@ LQIDAQAB
|
|||||||
`Allowing failure. Will retry one more time at next run interval.`
|
`Allowing failure. Will retry one more time at next run interval.`
|
||||||
);
|
);
|
||||||
// return last known good status
|
// return last known good status
|
||||||
return this.statusCache.get(
|
return status;
|
||||||
this.statusKey
|
|
||||||
) as LicenseStatus;
|
|
||||||
} else {
|
} else {
|
||||||
// Subsequent failures: fail abruptly
|
// Subsequent failures: fail abruptly
|
||||||
throw e;
|
throw e;
|
||||||
@@ -368,10 +362,7 @@ LQIDAQAB
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Only consider quantity if defined and >= 0 (quantity = users, quantity_2 = sites)
|
// Only consider quantity if defined and >= 0 (quantity = users, quantity_2 = sites)
|
||||||
if (
|
if (cached.quantity_2 !== undefined && cached.quantity_2 >= 0) {
|
||||||
cached.quantity_2 !== undefined &&
|
|
||||||
cached.quantity_2 >= 0
|
|
||||||
) {
|
|
||||||
status.maxSites =
|
status.maxSites =
|
||||||
(status.maxSites ?? 0) + cached.quantity_2;
|
(status.maxSites ?? 0) + cached.quantity_2;
|
||||||
}
|
}
|
||||||
@@ -561,7 +552,7 @@ LQIDAQAB
|
|||||||
// Calculate exponential backoff delay
|
// Calculate exponential backoff delay
|
||||||
const retryDelay = Math.floor(
|
const retryDelay = Math.floor(
|
||||||
initialRetryDelay *
|
initialRetryDelay *
|
||||||
Math.pow(exponentialFactor, attempt - 1)
|
Math.pow(exponentialFactor, attempt - 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
logger.debug(
|
logger.debug(
|
||||||
|
|||||||
Reference in New Issue
Block a user