arjan / singleton

Global, supervised singleton processes for Elixir
MIT License
108 stars 19 forks source link

Incompatibility with Elixir 1.10.0 – Singleton.start_child uses deprecated args #2

Closed rodrigues closed 4 years ago

rodrigues commented 4 years ago

Using singleton 1.2.0, In the latest stable elixir release, 1.10.0, Supervisor.start_child/2 doesn't expect a list as a second arg: https://github.com/elixir-lang/elixir/commit/98e60a842501bcb986830bcf39c7831f667f140a

In the code I call Singleton.start_child, dialyzer fails:

  # {{…}}
  def start_link(_opts) do
    Singleton.start_child(__MODULE__, [], __MODULE__)
  end
  # {{…}}
lib/{{…}}/scheduler.ex:7:no_return
Function start_link/1 has no local return.
________________________________________________________________________________
done (warnings were emitted)
Halting VM with exit status 2
arjan commented 4 years ago

Sorry I have no current project that uses this library so it has been going a bit unmaintained lately. Would you mind doing a PR?

rodrigues commented 4 years ago

@arjan thanks for your reply, I'll try fixing this soon 👍


EDIT: …err, maybe not that soon! This issue is in my pipeline for upgrading elixir 1.10 to some of our apps soon, but couldn't get yet to it.

Also not sure at this moment about making a PR, looks like it still works, despite of the deprecation and dialyzer errors (but not sure); the fix seems to suggest using DynamicSupervisor instead, and I'm afraid of changing it too much and breaking things for someone else… So we might end up removing the dependency on the fix, let's see.

nulian commented 4 years ago

@arjan Rewrote it to use dynamic supervisor

arjan commented 4 years ago

Thanks to @nulian the library now uses DynamicSupervisor :+1: I published version 1.3.0 to hex.pm.