chatops.ratelimit module

Rate-limit utilities for sensitive ChatOps commands.

  • Cooldown (seconds) per user+command, defaults to 5 seconds

  • Configured via ENV SENSITIVE_COMMAND_COOLDOWN_SEC

  • Decorator: limit_sensitive(command_name)

class chatops.ratelimit.SensitiveCommandRateLimiter(cooldown_sec=5)[מקור]

Bases: object

פרמטרים:

cooldown_sec (int)

__init__(cooldown_sec=5)[מקור]
פרמטרים:

cooldown_sec (int)

Return type:

None

property cooldown_sec: int
async should_allow(user_id, command_name)[מקור]
Return type:

Tuple[bool, int]

פרמטרים:
  • user_id (int)

  • command_name (str)

chatops.ratelimit.limit_sensitive(command_name)[מקור]

Decorator to throttle sensitive command handlers per user.

Return type:

Callable[[Callable[..., Awaitable[Any]]], Callable[..., Awaitable[Any]]]

פרמטרים:

command_name (str)