RateLimitPolicy#
- class rapidtools.processing.RateLimitPolicy(cooldown_seconds: float = 30.0, max_asset_retries: int = 2)[source]#
Bases:
objectShared back-off applied by
AssetAnalyzerto hosted APIs.When a request fails (rate limit, transient error, safety block), every worker pauses for
cooldown_secondsmultiplied by the number of consecutive failures; the first success resets the multiplier.Assets whose request failed are retried in additional passes once the first pass is complete (
max_asset_retries), so a burst of 429s or timeouts does not leave holes in the results.- Variables:
Example
>>> RateLimitPolicy(cooldown_seconds=10).wait_for(3) 30 >>> RateLimitPolicy(max_asset_retries=1).max_asset_retries 1
Methods
Return the pause (seconds) after
consecutive_errorsfailures.