Skip to content

Commit

Permalink
Fix monitor exclusion not being applied for newly detected nodes (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
KiKoS0 authored Nov 24, 2024
1 parent e1278ac commit 24ba777
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/cachex/router/ring/monitor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ defmodule Cachex.Router.Ring.Monitor do
type = Keyword.get(options, :monitor_type)

includes = Keyword.get(options, :monitor_includes, [])
excludes = Keyword.get(options, :monitor_includes, [])
excludes = Keyword.get(options, :monitor_excludes, [])

:ok = :net_kernel.monitor_nodes(true, node_type: type)

Expand Down
9 changes: 8 additions & 1 deletion test/cachex/router/ring_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ defmodule Cachex.Router.RingTest do
@tag distributed: true
test "routing keys via a ring router with excluded nodes" do
# create a test cache cluster for nodes
{cache, _nodes, _cluster} =
{cache, _nodes, cluster} =
TestUtils.create_cache_cluster(3,
router:
router(
Expand All @@ -143,6 +143,13 @@ defmodule Cachex.Router.RingTest do

# verify that only the manage was attached to the ring
assert Cachex.Router.nodes(cache) == {:ok, [node()]}

{:ok, [_member1]} = LocalCluster.start(cluster, 1)

:timer.sleep(250)

# make sure that the exclusion applies on newly detected nodes
assert Cachex.Router.nodes(cache) == {:ok, [node()]}
end

test "matching node names against include/exclude params" do
Expand Down

0 comments on commit 24ba777

Please sign in to comment.