-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Hi,
Your service initialization example (and maybe others) cause the following error in my application:
** (Mix) Could not start application my_app: MyApp.Application.start(:normal, []) returned an error: shutdown: failed to start child: MyApp.MyService
** (EXIT) an exception was raised:
** (FunctionClauseError) no function clause matching in Phoenix.PubSub.direct_broadcast/5
(phoenix_pubsub 2.0.0) lib/phoenix/pubsub.ex:218: Phoenix.PubSub.direct_broadcast(:nonode@nohost, Dispatch.PubSub, :my_service, {:join, #PID<0.4392.0>, %{node: :nonode@nohost, phx_ref: "Fg2eyx5VmOh4FdwB", state: :online}}, Phoenix.PubSub)
(dispatch 0.4.0) lib/dispatch/registry.ex:235: anonymous fn/4 in Dispatch.Registry.add_joins/3
(elixir 1.10.3) lib/enum.ex:2111: Enum."-reduce/3-lists^foldl/2-0-"/3
(dispatch 0.4.0) lib/dispatch/registry.ex:205: anonymous fn/3 in Dispatch.Registry.handle_diff/2
(stdlib 3.12.1) maps.erl:232: :maps.fold_1/3
(dispatch 0.4.0) lib/dispatch/registry.ex:200: Dispatch.Registry.handle_diff/2
(phoenix_pubsub 2.0.0) lib/phoenix/tracker/shard.ex:485: Phoenix.Tracker.Shard.report_diff_join/5
(phoenix_pubsub 2.0.0) lib/phoenix/tracker/shard.ex:294: Phoenix.Tracker.Shard.put_presence/6
I am referring to this example:
def init(_) do
:ok = Dispatch.Service.init(type: :uploader)
{:ok, %{}}
endI am assuming it is caused by the guards on phoenix_pubsub's direct_broadcast function, which specifies when is_binary(topic).
It seems to work fine if the service name is a binary and not an atom, e.g. Dispatch.Service.init(type: "my_service") instead of Dispatch.Service.init(type: :my_service).
Metadata
Metadata
Assignees
Labels
No labels