Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

MOD: Upgrade hackney & fix crash on startup #120

Merged
merged 7 commits into from
Feb 21, 2021
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [pull_request, push]
jobs:
mix_test:
name: mix test (Elixir ${{ matrix.elixir }} OTP ${{ matrix.otp }})
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
Expand All @@ -14,7 +14,7 @@ jobs:
otp: 23.0.3
steps:
- uses: actions/[email protected]
- uses: actions/setup-elixir@v1.5.0
- uses: erlef/setup-elixir@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
Expand Down
9 changes: 8 additions & 1 deletion lib/Discord/Gateway/manager.ex
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ defmodule Alchemy.Discord.Gateway.Manager do
Api.get!(url, token).body
|> (fn x -> Poison.Parser.parse!(x, %{}) end).()

{json["url"] <> "?v=6&encoding=json", json["shards"]}
case json do
%{"retry_after" => ms} ->
:timer.sleep(ms)
get_url(token, [])

_ ->
{json["url"] <> "?v=6&encoding=json", json["shards"]}
end
end

defp now, do: DateTime.utc_now() |> DateTime.to_unix()
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ defmodule Alchemy.Mixfile do

defp deps do
[
{:httpoison, "~> 1.5"},
{:httpoison, "~> 1.8"},
{:earmark, "~> 1.3", only: :dev},
{:websocket_client, "~> 1.3"},
{:ex_doc, "~> 0.20", only: :dev},
Expand Down