ratelimiter

The ratelimiter middleware restricts the frequency of calls to a rate with a maximum burst.

fnrunner Key

fnrun.middleware/ratelimiter

Configuration

The following table describes the keys on the configuration object for the ratelimiter middleware.

KeyTypeDefaultDescription
burstInteger1The maximum number of requests allowed in a burst
everyDuration1sThe period at which a call token is created

Examples

The following applies a ratelimiter to prevent calling the remote endpoint more than twice per second.

source: fnrun.source/http
middleware:
  - fnrun.middleware/ratelimiter:
      every: 500ms
fn: 
  fnrun.fn/http:
    targetURL: http://example.com/some-endpoint

Edit this page on GitHub