Skip to content

Commit

Permalink
set infinite timeout in benches
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslandoga committed Jan 12, 2024
1 parent 00842c7 commit f389861
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
16 changes: 10 additions & 6 deletions bench/insert.exs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,16 @@ Benchee.run(
|> Stream.run()
end,
"insert stream" => fn rows ->
DBConnection.run(conn, fn conn ->
rows
|> Stream.chunk_every(60_000)
|> Stream.map(fn chunk -> RowBinary.encode_rows(chunk, types) end)
|> Enum.into(Ch.stream(conn, statement))
end)
DBConnection.run(
conn,
fn conn ->
rows
|> Stream.chunk_every(60_000)
|> Stream.map(fn chunk -> RowBinary.encode_rows(chunk, types) end)
|> Enum.into(Ch.stream(conn, statement))
end,
timeout: :infinity
)
end
},
inputs: %{
Expand Down
24 changes: 14 additions & 10 deletions bench/stream.exs
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,20 @@ Benchee.run(
)
end,
"RowBinary stream with manual decode" => fn statement ->
DBConnection.run(conn, fn conn ->
conn
|> Ch.stream(statement, _params = [], format: "RowBinary")
|> Stream.map(fn %Ch.Result{data: data} ->
data
|> IO.iodata_to_binary()
|> Ch.RowBinary.decode_rows([:u64])
end)
|> Stream.run()
end)
DBConnection.run(
conn,
fn conn ->
conn
|> Ch.stream(statement, _params = [], format: "RowBinary")
|> Stream.map(fn %Ch.Result{data: data} ->
data
|> IO.iodata_to_binary()
|> Ch.RowBinary.decode_rows([:u64])
end)
|> Stream.run()
end,
timeout: :infinity
)
end
},
inputs: %{
Expand Down

0 comments on commit f389861

Please sign in to comment.