-
Notifications
You must be signed in to change notification settings - Fork 37
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
Update Deprecated :simple_one_to_one to use DynamicSupervisor in Elixir 1.6 #89
Conversation
@rockerBOO Hi, and thank you for this PR! Does it change anything regarding the public API? Could you include an example that leverages the dynamic supervision? |
We were using the AddedTo the public API, to allow access to the new module-based child specs, I added |
The actual problem case Im having, which might require expanding this (or another pull). In my tests I want to make a named client that is start_supervised. test "connection to the Twitch server" do
client = start_supervised!(ExIRC)
Process.register(client, :twitchirc)
end This fails because no What I wantWhat I want to do is like the following. Pass a name opts argument to the client. test "connection to the Twitch server" do
client = start_supervised!({ExIRC, [], name: :twitchirc})
end That would mean something like defmodule ExIRC do
@spec start_link!(opts \\ [], process_opts \\ [])
|
@rockerBOO You can make that addition to this PR. Also, make sure to rebase your branch on the current |
…temporary restart children specs for dynamic supervision.
import Supervisor.Spec | ||
use DynamicSupervisor | ||
|
||
defmodule TemporaryClient do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows us to define the module differently if it's started using the dynamic supervisor. There may be a few ways to do this but this seemed the most clear currently.
So after doing some testing I learned that I just needed So the key points of the pull request is now only with dynamic supervision to replace the deprecated code. Let me know if there is something I messed up. The |
README.md
Outdated
@@ -1,6 +1,7 @@ | |||
# ExIRC | |||
|
|||
[![Build Status](https://travis-ci.org/bitwalker/exirc.svg?branch=master)](https://travis-ci.org/bitwalker/exirc) | |||
![.github/workflows/tests.yaml](https://github.com/rockerBOO/exirc/workflows/.github/workflows/tests.yaml/badge.svg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beware, you're using your own repo's status for this badge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good spot :) thanks.
@rockerBOO I don't see anything to add. I'll let you aggregate your commits if this PR is ready to be merged. It's a fine work altogether, thank you very much for your patience and efforts. |
OK Travis, Github green. Should be good now. We likely want to increment the number as the version requirement has changed and will cause breaking due to Thanks Théophile! Thank you for your help :) |
Ah, it would seem that Coveralls is unhappy. Do you think you can make it smile again? And yes, this would warrant a new release. |
Ok coveralls is happy. |
Great, merging it now. |
Use dynamic supervision with DynamicSupervisor.
https://github.com/elixir-lang/elixir/blob/v1.6/CHANGELOG.md#dynamic-supervisor
https://hexdocs.pm/elixir/DynamicSupervisor.html#init/1
https://hexdocs.pm/elixir/DynamicSupervisor.html#module-migrating-from-supervisor-s-simple_one_for_one
Add ExIRC.start_link!/1
Requires Elixir 1.6