Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@whatyouhide
Copy link
Contributor

This is a work-in-progress to move Connection from being a GenServer underneath to being a gen_statem. This allows us to simplify the code and not use gen and proc_lib APIs.

assert_receive {:terminate, 1}
assert_receive {:EXIT, ^pid, {:shutdown, _}}
Logger.flush()
end) =~ ~r"error.*GenServer.*\(stop\) shutdown: #Function.*State: 1"sm
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@josevalim do we still need to do something like this, or is this related to proc_lib/gen?

Copy link
Member

Choose a reason for hiding this comment

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

The error message can change, yes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, but in particular I mean, do we still need to do manual logging here? I thought that by implementing format_status to return only the Connection module state (rather than the gen_statem state), we'd be fine?

Copy link
Member

Choose a reason for hiding this comment

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

I would perhaps drop the additional logging because both format_status and the logging API changed on OTP since this project was released.

@whatyouhide
Copy link
Contributor Author

@josevalim fantastic. Tests are passing over here πŸŽ‰

@hkrutzer
Copy link

I was just looking into this library and it looks good but unmaintained, and complex because of the use of proc_lib and such, so this change would be great.

@josevalim
Copy link
Member

@hkrutzer the library is not unmaintained.

@josevalim
Copy link
Member

However, it might go unmaintained based on elixir-ecto/db_connection#275. :D Because it may be that rolling your own with gen_statem now makes the most sense.

@whatyouhide
Copy link
Contributor Author

Super duper agreed: this PR is complex and risky. Switching db_connection to gen_statem is easier and makes more sense, so let's avoid touching this πŸ‘

@whatyouhide whatyouhide deleted the al/gen_statem2 branch February 10, 2023 16:28
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.

3 participants