Skip to content

Commit

Permalink
🩹 (telemetry) Better limit reached workspace filter
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Apr 19, 2023
1 parent a4ca413 commit fc56143
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/scripts/sendTotalResultsDigest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ const sendAlertIfLimitReached = async (
> & { members: Pick<MemberInWorkspace, 'userId' | 'role'>[] })[]
): Promise<TelemetryEvent[]> => {
const events: TelemetryEvent[] = []
const taggedWorkspaces: string[] = []
for (const workspace of workspaces) {
if (taggedWorkspaces.includes(workspace.id)) continue
taggedWorkspaces.push(workspace.id)
const { totalChatsUsed, totalStorageUsed } = await getUsage(workspace.id)
const totalStorageUsedInGb = totalStorageUsed / 1024 / 1024 / 1024
const chatsLimit = getChatsLimit(workspace)
Expand All @@ -137,7 +140,7 @@ const sendAlertIfLimitReached = async (
) {
events.push(
...workspace.members
.filter((member) => member.role !== WorkspaceRole.GUEST)
.filter((member) => member.role === WorkspaceRole.ADMIN)
.map(
(member) =>
({
Expand Down

0 comments on commit fc56143

Please sign in to comment.