Skip to content

Commit 697acd6

Browse files
committed
more coderabbit fixes
1 parent 7ce1191 commit 697acd6

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

apps/webapp/app/routes/admin.back-office.orgs.$orgId.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,23 @@ function describeRateLimit(
7878
maxTokens: number
7979
): { sustained: string; burst: string } | null {
8080
if (refillRate <= 0 || intervalMs <= 0 || maxTokens <= 0) return null;
81-
const perMin = Math.round((refillRate * 60_000) / intervalMs);
81+
const perMin = (refillRate * 60_000) / intervalMs;
82+
let sustained: string;
83+
if (perMin >= 1) {
84+
sustained = `${Math.round(perMin).toLocaleString()} requests per minute`;
85+
} else {
86+
const perHour = perMin * 60;
87+
if (perHour >= 1) {
88+
sustained = `${Math.round(perHour).toLocaleString()} requests per hour`;
89+
} else {
90+
const perDay = perHour * 24;
91+
const formatted =
92+
perDay >= 10 ? Math.round(perDay).toLocaleString() : perDay.toFixed(1);
93+
sustained = `${formatted} requests per day`;
94+
}
95+
}
8296
return {
83-
sustained: `${perMin.toLocaleString()} requests per minute`,
97+
sustained,
8498
burst: `${maxTokens.toLocaleString()} request burst allowance`,
8599
};
86100
}

0 commit comments

Comments
 (0)