Package com.mewna.catnip.rest.ratelimit
Interface RateLimiter
- All Known Implementing Classes:
DefaultRateLimiter
public interface RateLimiter
Ratelimiting for the REST API. The REST ratelimiter handles checking and
updating ratelimits based on the bucket that the requested route is
attempting to execute on.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
io.reactivex.rxjava3.core.Completable
requestExecution
(Routes.Route route) Requests execution for a specific route.void
updateDone
(Routes.Route route) void
updateGlobalRateLimit
(long resetTimestamp) void
updateLimit
(Routes.Route route, int limit) void
updateRemaining
(Routes.Route route, int remaining) void
updateReset
(Routes.Route route, long resetTimestamp)
-
Method Details
-
catnip
-
requestExecution
@Nonnull @CheckReturnValue io.reactivex.rxjava3.core.Completable requestExecution(@Nonnull Routes.Route route) Requests execution for a specific route. The route cannot be executed on until the bucket has requests available again, so the ratelimiter must handle this correctly.- Parameters:
route
- The route to execute.- Returns:
- A
Completable
that completes when the route can execute again.
-
updateRemaining
-
updateLimit
-
updateReset
-
updateDone
-
updateGlobalRateLimit
void updateGlobalRateLimit(long resetTimestamp)
-