Skip to content

Commit

Permalink
Merge branch 'fix/262/supervisor-crdt-delete' into integration
Browse files Browse the repository at this point in the history
  • Loading branch information
arjan committed Nov 6, 2023
2 parents fdce5a0 + b69792b commit 2f8b02f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/horde/dynamic_supervisor_impl.ex
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ defmodule Horde.DynamicSupervisorImpl do

case current_member do
%{status: :dead} ->
DeltaCrdt.delete(crdt_name(state.name), {:process, child_spec.id}, :infinity)
{_response, state} = add_child(randomize_child_id(child_spec), state)

state
Expand Down
12 changes: 12 additions & 0 deletions test/dynamic_supervisor_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,18 @@ defmodule DynamicSupervisorTest do

Process.sleep(5000)
assert_receive {:starting, 5000}, 100

# we have 2 supervised processes
processes = :sys.get_state(:horde_2_graceful).processes_by_id
assert Horde.TableUtils.size_of(processes) == 2

# peek into the remaining supervisor, getting the supervised pids
pids =
:sys.get_state(:horde_2_graceful).processes_by_id
|> :ets.tab2list()
|> Enum.map(&(elem(&1, 1) |> elem(2)))

assert Enum.all?(pids, &Process.alive?/1)
end
end

Expand Down

0 comments on commit 2f8b02f

Please sign in to comment.