Skip to content

Commit

Permalink
Minor fixes to specs and bench scripts (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
hchienjo authored Dec 30, 2024
1 parent 2dcf0a1 commit 8b92e8f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/phoenix/pubsub.ex
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ defmodule Phoenix.PubSub do
A custom dispatcher may also be given as a fifth, optional argument.
See the "Custom dispatching" section in the module documentation.
"""
@spec direct_broadcast(t, topic, message, dispatcher) :: :ok | {:error, term}
@spec direct_broadcast(node_name, t, topic, message, dispatcher) :: :ok | {:error, term}
def direct_broadcast(node_name, pubsub, topic, message, dispatcher \\ __MODULE__)
when is_atom(pubsub) and is_binary(topic) and is_atom(dispatcher) do
{:ok, {adapter, name}} = Registry.meta(pubsub, :pubsub)
Expand Down
2 changes: 1 addition & 1 deletion lib/phoenix/tracker/state.ex
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ defmodule Phoenix.Tracker.State do
## Examples
iex> Phoenix.Tracker.State.new(:replica1)
iex> Phoenix.Tracker.State.new(:replica1, :shard_name)
%Phoenix.Tracker.State{...}
"""
Expand Down
6 changes: 3 additions & 3 deletions script/bench.exs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ defmodule Bench do
topic_size = trunc(size / 10)

{s1, s2} = time "Creating 2 #{size} element sets", fn ->
s1 = Enum.reduce(1..size, State.new(:s1), fn i, acc ->
s1 = Enum.reduce(1..size, State.new(node(), :s1), fn i, acc ->

State.join(acc, make_ref(), "topic#{:erlang.phash2(i, topic_size)}", "user#{i}", %{name: i})
end)

s2 = Enum.reduce(1..size, State.new(:s2), fn i, acc ->
s2 = Enum.reduce(1..size, State.new(node(), :s2), fn i, acc ->
State.join(acc, make_ref(), "topic#{i}", "user#{i}", %{name: i})
end)

Expand Down Expand Up @@ -100,4 +100,4 @@ defmodule Bench do
end
end

Bench.run(System.argv())
Bench.run(System.argv())

0 comments on commit 8b92e8f

Please sign in to comment.