Skip to content

Commit 58032ad

Browse files
committed
Fix the warning: Supervisor.Spec.supervisor/2 is deprecated. Use the new child specifications outlined in the Supervisor module. by giving the referenced supervisors proper child_specs
1 parent 63ed44b commit 58032ad

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

lib/scenic.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ defmodule Scenic do
8585
defp do_init([]) do
8686
[
8787
{Scenic.ViewPort.Tables, nil},
88-
supervisor(Scenic.Cache.Support.Supervisor, []),
88+
{Scenic.Cache.Support.Supervisor, [nil]},
8989
{DynamicSupervisor, name: @viewports, strategy: :one_for_one}
9090
]
9191
|> Supervisor.init(strategy: :one_for_one)
@@ -96,8 +96,8 @@ defmodule Scenic do
9696
defp do_init(viewports) do
9797
[
9898
{Scenic.ViewPort.Tables, nil},
99-
supervisor(Scenic.Cache.Support.Supervisor, []),
100-
supervisor(Scenic.ViewPort.SupervisorTop, [viewports]),
99+
{Scenic.Cache.Support.Supervisor, [nil]},
100+
{Scenic.ViewPort.SupervisorTop, [viewports]},
101101
{DynamicSupervisor, name: @viewports, strategy: :one_for_one}
102102
]
103103
|> Supervisor.init(strategy: :one_for_one)

lib/scenic/cache/support/supervisor.ex

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,20 @@ defmodule Scenic.Cache.Support.Supervisor do
1111

1212
# import IEx
1313

14+
def child_spec() do
15+
%{
16+
id: __MODULE__,
17+
start: {__MODULE__, :start_link, nil},
18+
type: :supervisor,
19+
restart: :permanent,
20+
shutdown: 500
21+
}
22+
end
23+
1424
# ============================================================================
1525
# setup the viewport supervisor
1626

17-
def start_link() do
27+
def start_link(_) do
1828
Supervisor.start_link(__MODULE__, :ok)
1929
end
2030

lib/scenic/view_port/supervisor_top.ex

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ defmodule Scenic.ViewPort.SupervisorTop do
1717
# ============================================================================
1818
# setup the viewport supervisor
1919

20+
def child_spec(viewports) do
21+
%{
22+
id: __MODULE__,
23+
start: {__MODULE__, :start_link, viewports},
24+
type: :supervisor,
25+
restart: :permanent,
26+
shutdown: 500
27+
}
28+
end
29+
2030
def start_link(viewports) do
2131
Supervisor.start_link(__MODULE__, viewports)
2232
end

test/test_helper.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Registry.start_link(keys: :duplicate, name: :viewport_registry)
22
Registry.start_link(keys: :duplicate, name: :input_registry)
33
Registry.start_link(keys: :duplicate, name: :driver_registry)
4-
Scenic.Cache.Support.Supervisor.start_link()
4+
Scenic.Cache.Support.Supervisor.start_link(nil)
55
ExUnit.start()

0 commit comments

Comments
 (0)