crux_gateway v0.1.3 Crux.Gateway.Connection.RateLimiter View Source
Handles Rate Limiting for the gateway.
This module is automatically used by Crux.Gateway.Connection, you do not need to worry about it.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor
Queues a packet.
Blocks the calling process until the packet my be sent
Starts a rate limiter for a shard
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
queue(packet :: term(), shard_id :: non_neg_integer()) :: term()
Queues a packet.
Blocks the calling process until the packet my be sent.
The packets will return in the order as they arrive at the rate limiter, those are sent via GenServer.call/2.
Returns the packet as is.
Automatically invoked by using Crux.Gateway.Connection.send_command/2
start_link(shard_id :: non_neg_integer()) :: GenServer.on_start()
Starts a rate limiter for a shard.
This is automatically called when using Crux.Gateway.start/1.