(create-throttler rate-limits)
Creates a per-instance throttler with the given rate limits.
Merges the provided rate-limits
with the default configuration.
Parameters:
Returns: A Throttler record with a merged rate-limit configuration and an atom for limiter state.
Creates a per-instance throttler with the given rate limits. Merges the provided `rate-limits` with the default configuration. Parameters: - rate-limits: A map of custom rate limits Returns: A Throttler record with a merged rate-limit configuration and an atom for limiter state.
(set-rate-limits! throttler custom-limits)
Updates the throttler's rate-limit configuration with custom limits.
Resets the current limiter state and merges the new custom limits with the default configuration.
Parameters:
Returns: An updated throttler with new rate-limit configuration.
Updates the throttler's rate-limit configuration with custom limits. Resets the current limiter state and merges the new custom limits with the default configuration. Parameters: - throttler: The Throttler instance. - custom-limits: A map of custom rate limits. Returns: An updated throttler with new rate-limit configuration.
(with-throttling throttler method url api-key f)
Wraps the provided function f
with throttling logic using the per-instance throttler.
The throttling is based on a rate-limit configuration that distinguishes between test and live modes, different resources (using the URL), and HTTP methods (read for GET, write for others).
Parameters:
Returns:
The result of invoking f
after a token is successfully acquired.
Wraps the provided function `f` with throttling logic using the per-instance throttler. The throttling is based on a rate-limit configuration that distinguishes between test and live modes, different resources (using the URL), and HTTP methods (read for GET, write for others). Parameters: - throttler: A Throttler instance. - method: HTTP method keyword (:get, :post, etc.). - url: The full URL for the API endpoint. - api-key: Used to determine whether the requests are in test or live mode. - f: The function to execute once a token is acquired. Returns: The result of invoking `f` after a token is successfully acquired.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close