mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 02:44:02 +00:00
fix(server): keep cost throttles on for positive fractional limits
A limit such as 0.5 floored to 0 and disabled the throttle, although only an explicit 0 is meant to. Positive values below 1 now count as 1. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
9b4ccbff62
commit
913d45bc07
3 files changed
+19
-2
No files matched your search
@@ -23,6 +23,9 @@ export function resolvePerMinuteCap(envValue, defaultPerMin) {
|
||||
if (raw === undefined || raw === null || raw === '') return defaultPerMin;
|
||||
const parsed = Number(raw);
|
||||
if (!Number.isFinite(parsed) || parsed < 0) return defaultPerMin;
|
||||
// Only an explicit 0 disables the guard: a positive fraction such as 0.5
|
||||
// would floor to 0, so it takes the strictest real cap instead.
|
||||
if (parsed > 0 && parsed < 1) return 1;
|
||||
return Math.floor(parsed); // includes the explicit 0 = unlimited opt-out
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user