Skip to content

Commit

Permalink
Bump ex_doc from 0.31.2 to 0.32.1 (#186)
Browse files Browse the repository at this point in the history
Bumps [ex_doc](https://github.com/elixir-lang/ex_doc) from 0.31.2 to 0.32.1.
- [Release notes](https://github.com/elixir-lang/ex_doc/releases)
- [Changelog](https://github.com/elixir-lang/ex_doc/blob/main/CHANGELOG.md)
- [Commits](elixir-lang/ex_doc@v0.31.2...v0.32.1)

---
updated-dependencies:
- dependency-name: ex_doc
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
dependabot[bot] authored and mbusi committed Apr 26, 2024
1 parent 2486c8c commit 4cd6575
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
erlang 23.1
elixir 1.11.2-otp-23
erlang 26.2.1
elixir 1.14.3
12 changes: 8 additions & 4 deletions lib/amqp/gen/connection_manager.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ defmodule Amqpx.Gen.ConnectionManager do
end

def init(opts) do
Process.flag(:trap_exit, true)
state = struct(__MODULE__, opts)
Process.send(self(), :setup, [])
{:ok, state}
Expand Down Expand Up @@ -54,8 +55,6 @@ defmodule Amqpx.Gen.ConnectionManager do
{:stop, :connection_exited, state}
end

def handle_info({:EXIT, _pid, :normal}, state), do: {:stop, :EXIT, state}

def handle_info(message, state) do
Logger.warn("Unknown message received #{inspect(message)}")
{:noreply, state}
Expand All @@ -64,14 +63,19 @@ defmodule Amqpx.Gen.ConnectionManager do
def terminate(_, %__MODULE__{connection: nil}), do: nil

def terminate(_, %__MODULE__{connection: connection}) do
Logger.warning("terminating connection manager")

if Process.alive?(connection.pid) do
Process.exit(connection.pid, :kill)
Logger.warning("closing connection")
Connection.close(connection)
end
end

@spec connect(map) :: {:ok, Connection.t()} | {:error, any}
defp connect(connection_params) do
with {:ok, connection} <- Connection.open(connection_params) do
name = connection_params |> Keyword.get(:name, Amqpx.Gen.ConnectionManager) |> to_string()

with {:ok, connection} <- Connection.open(connection_params, name) do
Process.monitor(connection.pid)

{:ok, connection}
Expand Down
20 changes: 14 additions & 6 deletions lib/amqp/gen/consumer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ defmodule Amqpx.Gen.Consumer do
:channel,
:handler_module,
:handler_state,
:consumer_tag,
prefetch_count: 50,
backoff: 5_000,
connection_name: Amqpx.Gen.ConnectionManager,
Expand Down Expand Up @@ -70,8 +71,8 @@ defmodule Amqpx.Gen.Consumer do
end

# Confirmation sent by the broker after registering this process as a consumer
def handle_info({:"basic.consume_ok", _consumer_tag}, state) do
{:noreply, state}
def handle_info({:"basic.consume_ok", consumer_tag}, state) do
{:noreply, %{state | consumer_tag: consumer_tag}}
end

# Sent by the broker when the consumer is unexpectedly cancelled
Expand All @@ -81,12 +82,12 @@ defmodule Amqpx.Gen.Consumer do

# Received if we call Basic.cancel
def handle_info({:"basic.cancel", _consumer_tag, _nowait}, state) do
{:noreply, state, :hibernate}
{:noreply, state}
end

# Confirmation sent by the broker to the consumer process after a Basic.cancel
def handle_info({:"basic.cancel_ok", _consumer_tag}, state) do
{:stop, :basic_cancel_ok, state}
{:noreply, state}
end

def handle_info(
Expand Down Expand Up @@ -187,23 +188,30 @@ defmodule Amqpx.Gen.Consumer do

def terminate(_, %__MODULE__{channel: nil}), do: nil

def terminate(reason, %__MODULE__{channel: channel}) do
def terminate(reason, %__MODULE__{channel: channel, consumer_tag: consumer_tag}) do
Logger.warning("terminating consumer, reason:#{reason}")

Basic.cancel(channel, consumer_tag)

case reason do
:normal -> close_channel(channel)
:shutdown -> close_channel(channel)
{:shutdown, _} -> close_channel(channel)
_ -> :ok
end
exit(:normal)
end

# Private functions

defp close_channel(%{pid: pid} = channel) do
if Process.alive?(pid) do
Logger.warning("closing channel, pid:#{inspect(pid)}")
Channel.close(channel)

receive do
{:DOWN, _, :process, ^pid, _reason} ->
{:DOWN, _, :process, ^pid, reason} ->
Logger.warning("channel is down, pid:#{inspect(pid)}, reason:#{reason}")
:ok
end
end
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule Amqpx.MixProject do
app: :amqpx,
name: "amqpx",
version: "6.0.2-rc.0",
elixir: "~> 1.7",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :production,
deps: deps(),
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"},
"elixir_uuid": {:hex, :elixir_uuid, "1.2.1", "dce506597acb7e6b0daeaff52ff6a9043f5919a4c3315abb4143f0b00378c097", [:mix], [], "hexpm", "f7eba2ea6c3555cea09706492716b0d87397b88946e6380898c2889d68585752"},
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
"ex_doc": {:hex, :ex_doc, "0.31.2", "8b06d0a5ac69e1a54df35519c951f1f44a7b7ca9a5bb7a260cd8a174d6322ece", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.1", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "317346c14febaba9ca40fd97b5b5919f7751fb85d399cc8e7e8872049f37e0af"},
"ex_doc": {:hex, :ex_doc, "0.32.1", "21e40f939515373bcdc9cffe65f3b3543f05015ac6c3d01d991874129d173420", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.1", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "5142c9db521f106d61ff33250f779807ed2a88620e472ac95dc7d59c380113da"},
"file_system": {:hex, :file_system, "1.0.0", "b689cc7dcee665f774de94b5a832e578bd7963c8e637ef940cd44327db7de2cd", [:mix], [], "hexpm", "6752092d66aec5a10e662aefeed8ddb9531d79db0bc145bb8c40325ca1d8536d"},
"jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"},
"makeup": {:hex, :makeup, "1.1.1", "fa0bc768698053b2b3869fa8a62616501ff9d11a562f3ce39580d60860c3a55e", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "5dc62fbdd0de44de194898b6710692490be74baa02d9d108bc29f007783b0b48"},
Expand Down

0 comments on commit 4cd6575

Please # to comment.