Loading
refactor(rate_limit): simplify Lua script to always INCRBYFLOAT
Replace the cost=0 GET short-circuit with a uniform INCRBYFLOAT branch.
The short-circuit was originally there to avoid allocating Redis keys
for cohort 5 zero-usage callers (IncrementResourceUsagePerAction), but
the actual call volume is small enough that the branch's complexity
isn't paying for itself. INCRBYFLOAT with cost=0 is a no-op on the
stored value, with the trade that:
- Cost=0 against a missing key now allocates a key at value 0 with
the rule's TTL (was: no allocation).
- Cost=0 against an existing key issues a write op (was: pure GET).
The observable count and TTL are unchanged.
Cohort 5 reviewers should be aware that zero-usage workers no longer
get a free pass at the storage layer. At the call rates involved
(~< 100/sec fleet-wide), the additional allocation is well below the
noise floor and the simpler primitive is easier to reason about.
Addresses !291 review thread 148bc41b.