Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

allow http1 connections in ratelimiter #522

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/nostrum/api/ratelimiter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ defmodule Nostrum.Api.Ratelimiter do
`0.8`, nostrum used to use a `GenServer` that would call out to ETS tables to
look up ratelimiting buckets for requests. If it needed to sleep before
issuing a request due to the bucket being exhausted, it would do so in the
server process and block other callers.
server process and block other callers.

In nostrum 0.8, the existing ratelimiter bucket storage architecture was
refactored to be based around the [pluggable caching
Expand Down Expand Up @@ -377,7 +377,7 @@ defmodule Nostrum.Api.Ratelimiter do
{:keep_state, %{data | conn: conn_pid}}
end

def connecting(:info, {:gun_up, conn_pid, :http2}, %{conn: conn_pid} = data) do
def connecting(:info, {:gun_up, conn_pid, _}, %{conn: conn_pid} = data) do
{:next_state, :connected, data}
end

Expand Down Expand Up @@ -865,7 +865,7 @@ defmodule Nostrum.Api.Ratelimiter do
{:next_event, :internal, {:requeue, {request, from}}}}
end

def connected(:info, {:gun_down, conn, :http2, reason, killed_streams}, %{running: running}) do
def connected(:info, {:gun_down, conn, _, reason, killed_streams}, %{running: running}) do
# Even with `retry: 0`, gun seems to try and reconnect, potentially because
# of WebSocket. Force the connection to die.
:ok = :gun.close(conn)
Expand Down