crux_rest v0.1.3 Crux.Rest.Handler.Global View Source

Handles global rate limits and the average time offset to discord.

All functions in Crux.Rest automatically use this module, you do not need to worry about it.

Link to this section Summary

Functions

Adds an offset to the list of offsets

Returns a specification to start this module under a supervisor

Fetches how long to wait until the global rate limit is over.
Is not positive when not rate limited

Fetches the average out of the last ten offsets to discord servers in milliseconds

Sets the global wait time if rate limited globally

Starts the global rate limite handler

Link to this section Functions

Link to this function add_offset(offset) View Source
add_offset(offset :: integer()) :: :ok

Adds an offset to the list of offsets.

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function fetch_global_wait() View Source
fetch_global_wait() :: integer()

Fetches how long to wait until the global rate limit is over.
Is not positive when not rate limited.

Link to this function fetch_offset() View Source
fetch_offset() :: integer()

Fetches the average out of the last ten offsets to discord servers in milliseconds.

Link to this function set_global_wait(retry_after) View Source
set_global_wait(retry_after :: pos_integer()) :: :ok

Sets the global wait time if rate limited globally.

Link to this function start_link(args) View Source
start_link(route :: String.t()) :: GenServer.on_start()

Starts the global rate limite handler.