Use a bigger chunk size when transferring files across nodes (#2738)

This commit is contained in:
Jonatan Kłosko 2024-08-09 14:50:37 +02:00
parent 29ca926f39
commit d78b98455a
2 changed files with 2 additions and 2 deletions

View file

@ -177,7 +177,7 @@ defmodule Livebook.Runtime.ErlDist.RuntimeServer do
{:transfer, target_path, target_pid} -> {:transfer, target_path, target_pid} ->
try do try do
path path
|> File.stream!(2048, []) |> File.stream!(64_000, [])
|> Enum.each(fn chunk -> IO.binwrite(target_pid, chunk) end) |> Enum.each(fn chunk -> IO.binwrite(target_pid, chunk) end)
target_path target_path

View file

@ -304,7 +304,7 @@ defmodule LivebookWeb.SessionController do
defp transfer_file!(remote_node, remote_path, local_path) do defp transfer_file!(remote_node, remote_path, local_path) do
File.mkdir_p!(Path.dirname(local_path)) File.mkdir_p!(Path.dirname(local_path))
remote_stream = :erpc.call(remote_node, File, :stream!, [remote_path, 2048, []]) remote_stream = :erpc.call(remote_node, File, :stream!, [remote_path, 64_000, []])
local_stream = File.stream!(local_path) local_stream = File.stream!(local_path)
Enum.into(remote_stream, local_stream) Enum.into(remote_stream, local_stream)
end end