nationstates-0.5.0.0: NationStates API client

Safe HaskellSafe
LanguageHaskell2010

NationStates.RateLimit

Description

Simple rate limiting combinator.

Synopsis

Documentation

newRateLimit Source

Arguments

:: Rational

Delay, in seconds

-> IO RateLimit 

Create a new rate limiter with the specified delay.

The rate limiter is thread-safe, and can be shared between threads.

rateLimit :: RateLimit -> IO a -> IO a Source

Run the given action, pausing as necessary to keep under the rate limit.

setDelay :: Rational -> RateLimit -> RateLimit Source

Create a new rate limiter with the same lock but a different delay.