Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix connection manager #191

Merged
merged 5 commits into from
May 28, 2024
Merged

Fix connection manager #191

merged 5 commits into from
May 28, 2024

Conversation

mbusi
Copy link
Contributor

@mbusi mbusi commented May 21, 2024

The ConnectionManager module was implementing the GenServer behaviour, with a proper terminate/2 function but it wasn't trapping exits so the terminate wasn't being called (ever). Moreover, it was abrutly closing the connection with an exit/2 call instead of using the proper function.

@mbusi mbusi marked this pull request as ready for review May 21, 2024 08:22
@mbusi mbusi requested a review from a team as a code owner May 21, 2024 08:22
@@ -65,13 +64,15 @@ defmodule Amqpx.Gen.ConnectionManager do

def terminate(_, %__MODULE__{connection: connection}) do
if Process.alive?(connection.pid) do
Process.exit(connection.pid, :kill)
Connection.close(connection)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw that Connection.close could return an error. It's true that here we are inside a terminate function and there's not so much we can do, but maybe it could be worthwhile to add a log for that scenario, WDYT?

@mbusi mbusi merged commit d52209b into master May 28, 2024
3 checks passed
@mbusi mbusi deleted the connection branch May 28, 2024 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants