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

Commit

Permalink
Merge pull request #120 from Zarathustra2/master
Browse files Browse the repository at this point in the history
MOD: Upgrade hackney & fix crash on startup
  • Loading branch information
cronokirby authored Feb 21, 2021
2 parents 53b1b3b + 49d6c71 commit 48cd36e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
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

0 comments on commit 48cd36e

Please sign in to comment.