Tornex.NodeRatelimiter (Tornex v0.5.1)

Copy Markdown View Source

A module backed by an ETS to mark when a node is ratelimited.

To make this easy to use and to prevent race conditions, this ETS is wrapped in a GenServer that needs to be started in the parent application's supervision tree.

Summary

Functions

Returns a specification to start this module under a supervisor.

Check if this node is ratelimited.

Set this node to be ratelimited until the end of the current minute.

Initialize the ETS table for the node ratelimiter.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

ratelimited?(opts \\ [])

@spec ratelimited?(opts :: keyword()) :: boolean()

Check if this node is ratelimited.

set_ratelimited(opts \\ [])

@spec set_ratelimited(opts :: keyword()) :: term()

Set this node to be ratelimited until the end of the current minute.

start_link(opts \\ [])

@spec start_link(opts :: keyword()) :: GenServer.on_start()

Initialize the ETS table for the node ratelimiter.