Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit 7345e3f

Browse files
MichaelBakerConnorRigby
authored andcommitted
Provides a default timeout for fetch_all and fetch-all!
1 parent f30e9e8 commit 7345e3f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/sqlitex/statement.ex

+4-2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ defmodule Sqlitex.Statement do
7474
column_types: []
7575

7676
@chunk_size 5000
77+
@default_timeout 5000
7778

7879
alias Sqlitex.Config
7980

@@ -180,7 +181,8 @@ defmodule Sqlitex.Statement do
180181
* `{:ok, results}`
181182
* `{:error, error}`
182183
"""
183-
def fetch_all(statement, timeout, into \\ []) do
184+
185+
def fetch_all(statement, timeout \\ @default_timeout, into \\ []) do
184186
case raw_fetch_all(statement, timeout) do
185187
{:error, _} = other -> other
186188
raw_data ->
@@ -200,7 +202,7 @@ defmodule Sqlitex.Statement do
200202
201203
Returns the results otherwise.
202204
"""
203-
def fetch_all!(statement, timeout, into \\ []) do
205+
def fetch_all!(statement, timeout \\ @default_timeout, into \\ []) do
204206
case fetch_all(statement, timeout, into) do
205207
{:ok, results} -> results
206208
{:error, reason} -> raise Sqlitex.Statement.FetchAllError, reason: reason

0 commit comments

Comments
 (0)