Skip to content

Commit

Permalink
Fix: call State.new/2 with 2 args in bench and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
preciz committed Sep 7, 2024
1 parent 685dc86 commit 12cd52a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
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
5 changes: 2 additions & 3 deletions script/bench.exs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ 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(:s1, :shard1), 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(:s2, :shard2), fn i, acc ->
State.join(acc, make_ref(), "topic#{i}", "user#{i}", %{name: i})
end)

Expand Down

0 comments on commit 12cd52a

Please sign in to comment.