Rulvar API reference / @rulvar/core / quotaRuleAdmission
Function: quotaRuleAdmission()
ts
function quotaRuleAdmission(
rule,
counters,
estimate,
msUntilWindowEnd):
| {
admit: true;
}
| {
admit: false;
reason: string;
retryAfterMs: number;
};Defined in: packages/core/src/model/quota.ts:275
One rule's admission verdict against its current-window counters, the pure decision both reference implementations share. A denial carries the window remainder as retryAfterMs, except when the estimate alone can never fit the token cap: that denial says retryAfterMs 0 (retry immediately), so the caller's bounded attempts exhaust without waiting and failover gets its chance.
Parameters
| Parameter | Type |
|---|---|
rule | QuotaRule |
counters | QuotaCounters |
estimate | QuotaCounters |
msUntilWindowEnd | number |
Returns
| { admit: true; } | { admit: false; reason: string; retryAfterMs: number; }