crux_gateway v0.1.0 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

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

Link to this function queue(packet, shard_id) View Source
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

Link to this function start_link(shard_id) View Source
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.