🩹 Correctly convert totalStorageUsed for limit telemetry
This commit is contained in:
@ -128,11 +128,12 @@ const sendAlertIfLimitReached = async (
|
|||||||
const events: TelemetryEvent[] = []
|
const events: TelemetryEvent[] = []
|
||||||
for (const workspace of workspaces) {
|
for (const workspace of workspaces) {
|
||||||
const { totalChatsUsed, totalStorageUsed } = await getUsage(workspace.id)
|
const { totalChatsUsed, totalStorageUsed } = await getUsage(workspace.id)
|
||||||
|
const totalStorageUsedInGb = totalStorageUsed / 1024 / 1024 / 1024
|
||||||
const chatsLimit = getChatsLimit(workspace)
|
const chatsLimit = getChatsLimit(workspace)
|
||||||
const storageLimit = getStorageLimit(workspace)
|
const storageLimit = getStorageLimit(workspace)
|
||||||
if (
|
if (
|
||||||
(chatsLimit > 0 && totalChatsUsed >= chatsLimit) ||
|
(chatsLimit > 0 && totalChatsUsed >= chatsLimit) ||
|
||||||
(storageLimit > 0 && totalStorageUsed >= storageLimit)
|
(storageLimit > 0 && totalStorageUsedInGb >= storageLimit)
|
||||||
) {
|
) {
|
||||||
events.push(
|
events.push(
|
||||||
...workspace.members
|
...workspace.members
|
||||||
@ -145,7 +146,7 @@ const sendAlertIfLimitReached = async (
|
|||||||
workspaceId: workspace.id,
|
workspaceId: workspace.id,
|
||||||
data: {
|
data: {
|
||||||
totalChatsUsed,
|
totalChatsUsed,
|
||||||
totalStorageUsed,
|
totalStorageUsed: totalStorageUsedInGb,
|
||||||
chatsLimit,
|
chatsLimit,
|
||||||
storageLimit,
|
storageLimit,
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user