Package com.mewna.catnip.shard.ratelimit
Interface Ratelimiter
- All Known Implementing Classes:
MemoryRatelimiter
public interface Ratelimiter
Ratelimiting for the gateway websockets, aka shards.
- Since:
- 8/16/18.
- Author:
- amy
-
Method Summary
Modifier and TypeMethodDescriptioncheckRatelimit
(String id, long periodMs, long limit) Checks if the id is ratelimited, based on the period and the limit-per-period.
-
Method Details
-
checkRatelimit
org.apache.commons.lang3.tuple.ImmutablePair<Boolean,Long> checkRatelimit(String id, long periodMs, long limit) Checks if the id is ratelimited, based on the period and the limit-per-period.- Parameters:
id
- id to checkperiodMs
- period of ratelimit resetlimit
- max "uses" before ratelimit for a given period is hit- Returns:
- A (isRatelimited, amountRemaining) tuple
-