[]previous and next page

RateLimitDecision

Result of taking tokens from a bucket.

Result of taking tokens from a bucket.

Import#

ts
import type { RateLimitDecision } from "@shadow-js/dusk/server";

Signature#

ts
interface RateLimitDecision {
  readonly allowed: boolean;
  /** Tokens left after this request (rounded down). */
  readonly remaining: number;
  /** Milliseconds until `cost` tokens are available; 0 when allowed. */
  readonly retryAfterMs: number;
  /** Milliseconds until the bucket is full again. */
  readonly resetMs: number;
}

Members#

Name Type Description
allowed readonly allowed: boolean
remaining readonly remaining: number Tokens left after this request (rounded down).
retryAfterMs readonly retryAfterMs: number Milliseconds until cost tokens are available; 0 when allowed.
resetMs readonly resetMs: number Milliseconds until the bucket is full again.