CheckRateLimit (open)
Implements rate limiting
Syntax
LOADLIB "mod::system/lib/services.whlib";
RECORD FUNCTION CheckRateLimit(RECORD criterium, INTEGER numhits, RECORD options)Parameters
RECORD criteriumA record describing this rate limit (hashed to generate a unique key), eg an ip address and/or service name
INTEGER numhitsNumber of hits to accept in the time period
RECORD optionsOptions
BOOLEAN exemptdevExempt development servers from the ratelimit (if this is a request, add a header to indicate the rate was hit)
INTEGER timeperiodTime period to which the limit applies in ms. Defaults to 1 minute (60000)
Return value
RECORDLimit check result
BOOLEAN acceptedIf TRUE, accept this request, rate limit not hit
INTEGER backoffIf >0, recommended backoff time before requests will be accepted again (in ms)