moo.sdk.ratelimit

Per-account broadcast flood limiting.

RestrictedPython here uses a plain iterator and the only runaway backstop is the Celery wall-clock kill — neither bounds a verb that spams everyone present within the time budget (the $spew problem). This module is that limiter: a fixed-window counter, keyed to the initiating account, that bounds outbound broadcast lines (messages an account causes to be sent to other players). A player’s own output is never counted, so a long room description or a verbose NPC is never clipped — the target is flooding, not verbosity.

The limit and window default to settings.MOO_BROADCAST_RATE_LIMIT / MOO_BROADCAST_RATE_WINDOW and may be overridden at runtime by the System Object properties broadcast_rate_limit / broadcast_rate_window (the “sys knob”).

Functions

broadcast_allowed(account_id)

Charge one broadcast line to account_id and report whether it is allowed.

broadcast_limit()

The effective per-window broadcast line budget (0 disables).

broadcast_window()

The effective fixed-window length in seconds.