Skip to content

Commit a7bf120

Browse files
committed
Fix race in registry tests from duplicate names
1 parent b56a907 commit a7bf120

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lib/elixir/lib/registry.ex

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -757,28 +757,28 @@ defmodule Registry do
757757
In the example below we register the current process and look it up
758758
both from itself and other processes:
759759
760-
iex> Registry.start_link(keys: :unique, name: Registry.UniqueLookupTest)
761-
iex> Registry.values(Registry.UniqueLookupTest, "hello", self())
760+
iex> Registry.start_link(keys: :unique, name: Registry.UniqueValuesTest)
761+
iex> Registry.values(Registry.UniqueValuesTest, "hello", self())
762762
[]
763-
iex> {:ok, _} = Registry.register(Registry.UniqueLookupTest, "hello", :world)
764-
iex> Registry.values(Registry.UniqueLookupTest, "hello", self())
763+
iex> {:ok, _} = Registry.register(Registry.UniqueValuesTest, "hello", :world)
764+
iex> Registry.values(Registry.UniqueValuesTest, "hello", self())
765765
[:world]
766-
iex> Task.async(fn -> Registry.values(Registry.UniqueLookupTest, "hello", self()) end) |> Task.await()
766+
iex> Task.async(fn -> Registry.values(Registry.UniqueValuesTest, "hello", self()) end) |> Task.await()
767767
[]
768768
iex> parent = self()
769-
iex> Task.async(fn -> Registry.values(Registry.UniqueLookupTest, "hello", parent) end) |> Task.await()
769+
iex> Task.async(fn -> Registry.values(Registry.UniqueValuesTest, "hello", parent) end) |> Task.await()
770770
[:world]
771771
772772
The same applies to duplicate registries:
773773
774-
iex> Registry.start_link(keys: :duplicate, name: Registry.DuplicateLookupTest)
775-
iex> Registry.values(Registry.DuplicateLookupTest, "hello", self())
774+
iex> Registry.start_link(keys: :duplicate, name: Registry.DuplicateValuesTest)
775+
iex> Registry.values(Registry.DuplicateValuesTest, "hello", self())
776776
[]
777-
iex> {:ok, _} = Registry.register(Registry.DuplicateLookupTest, "hello", :world)
778-
iex> Registry.values(Registry.DuplicateLookupTest, "hello", self())
777+
iex> {:ok, _} = Registry.register(Registry.DuplicateValuesTest, "hello", :world)
778+
iex> Registry.values(Registry.DuplicateValuesTest, "hello", self())
779779
[:world]
780-
iex> {:ok, _} = Registry.register(Registry.DuplicateLookupTest, "hello", :another)
781-
iex> Enum.sort(Registry.values(Registry.DuplicateLookupTest, "hello", self()))
780+
iex> {:ok, _} = Registry.register(Registry.DuplicateValuesTest, "hello", :another)
781+
iex> Enum.sort(Registry.values(Registry.DuplicateValuesTest, "hello", self()))
782782
[:another, :world]
783783
784784
"""

0 commit comments

Comments
 (0)