Skip to content

Commit 9aa4f56

Browse files
fix timeout
1 parent c6f6640 commit 9aa4f56

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/ecto/adapters/myxql.ex

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ defmodule Ecto.Adapters.MyXQL do
425425
config[:database]
426426
]
427427

428-
case run_with_port("mysql", config, args, contents) do
428+
case run_with_port("mysql", config, args, path) do
429429
{_output, 0} -> {:ok, path}
430430
{output, _} -> {:error, output}
431431
end
@@ -543,7 +543,7 @@ defmodule Ecto.Adapters.MyXQL do
543543
# intent of using file redirection for passing dumps
544544
# into the mysql client so that users don't run into
545545
# shell limits when files are too large
546-
defp run_with_port(cmd, opts, opt_args, contents, cmd_opts \\ []) do
546+
defp run_with_port(cmd, opts, opt_args, path, cmd_opts \\ []) do
547547
unless System.find_executable(cmd) do
548548
raise "could not find executable `#{cmd}` in path, " <>
549549
"please guarantee it is available before running ecto commands"
@@ -561,9 +561,10 @@ defmodule Ecto.Adapters.MyXQL do
561561

562562
port_opts = port_opts(cmd_opts, args: args)
563563
port = Port.open({:spawn_executable, cmd}, port_opts)
564-
IO.inspect port
565-
IO.inspect Port.command(port, contents)
566-
IO.inspect Port.command(port, "\n")
564+
File.stream!(path, [], 64 * 1024)
565+
|> Enum.each(fn chunk ->
566+
true = Port.command(port, chunk)
567+
end)
567568

568569
{initial, fun} = Collectable.into("")
569570

0 commit comments

Comments
 (0)