From 12cd52a7873ab523cfd8fbe26cf08b7abd572a13 Mon Sep 17 00:00:00 2001 From: preciz Date: Sat, 7 Sep 2024 14:16:33 +0200 Subject: [PATCH] Fix: call State.new/2 with 2 args in bench and docs --- lib/phoenix/tracker/state.ex | 2 +- script/bench.exs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/phoenix/tracker/state.ex b/lib/phoenix/tracker/state.ex index 4d9a88cc7..c315974e9 100644 --- a/lib/phoenix/tracker/state.ex +++ b/lib/phoenix/tracker/state.ex @@ -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{...} """ diff --git a/script/bench.exs b/script/bench.exs index 4bdd163ab..130eda8b3 100644 --- a/script/bench.exs +++ b/script/bench.exs @@ -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)