Skip to content

Commit 194488f

Browse files
committed
Define child_spec for Postgrex.Notifications, closes #548
1 parent e6052cb commit 194488f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Diff for: lib/postgrex/notifications.ex

+8
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ defmodule Postgrex.Notifications do
8484

8585
@type server :: GenServer.server()
8686

87+
@doc false
88+
def child_spec(opts) do
89+
%{
90+
id: __MODULE__,
91+
start: {__MODULE__, :start_link, [opts]}
92+
}
93+
end
94+
8795
@doc """
8896
Start the notification connection process and connect to postgres.
8997

Diff for: test/notification_test.exs

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ defmodule NotificationTest do
1212
{:ok, [pid: pid, pid_ps: pid_ps]}
1313
end
1414

15+
test "defines child spec" do
16+
start_supervised!({PN, @opts})
17+
end
18+
1519
test "fails on sync connection by default" do
1620
Process.flag(:trap_exit, true)
1721
assert {:error, _} = PN.start_link(database: "nobody_knows_it")

0 commit comments

Comments
 (0)