Skip to content

Commit 893d1a6

Browse files
authored
Use is_pid and improve doc (#313)
1 parent 9a4e113 commit 893d1a6

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

lib/db_connection.ex

+3-3
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ defmodule DBConnection do
171171
to allow the checkout or `{:disconnect, exception, state}` to disconnect.
172172
173173
This callback is called immediately after the connection is established
174-
and the state is never effetively checked in again. That's because
174+
and the state is never effectively checked in again. That's because
175175
DBConnection keeps the connection state in an ETS table that is moved
176176
between the different clients checking out connections. There is no
177177
`checkin` callback. The state is only handed back to the connection
@@ -1274,13 +1274,13 @@ defmodule DBConnection do
12741274
end
12751275

12761276
@doc """
1277-
Returns connection module used by the given connection pool.
1277+
Returns the connection module used by the given connection pool.
12781278
12791279
When given a process that is not a connection pool, returns an `:error`.
12801280
"""
12811281
@spec connection_module(conn) :: {:ok, module} | :error
12821282
def connection_module(conn) do
1283-
with pid when pid != nil <- pool_pid(conn),
1283+
with pid when is_pid(pid) <- pool_pid(conn),
12841284
{:dictionary, dictionary} <- Process.info(pid, :dictionary),
12851285
{@connection_module_key, module} <- List.keyfind(dictionary, @connection_module_key, 0),
12861286
do: {:ok, module},

lib/db_connection/ownership.ex

+1-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ defmodule DBConnection.Ownership do
9494
9595
It may return `:ok` if the connection is checked out.
9696
`{:already, :owner | :allowed}` if the caller process already
97-
has a connection, `:error` if it could be not checked out or
98-
raise if there was an error.
97+
has a connection, or raise if there was an error.
9998
"""
10099
@spec ownership_checkout(GenServer.server(), Keyword.t()) ::
101100
:ok | {:already, :owner | :allowed}

0 commit comments

Comments
 (0)