From 7d5540de7159afee716a64a54519abae81b9b001 Mon Sep 17 00:00:00 2001 From: Coby Benveniste Date: Tue, 7 Jan 2025 20:58:55 +0200 Subject: [PATCH 1/5] Set the timeout to max between itself and the boot_timeout --- lib/flame/runner.ex | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/flame/runner.ex b/lib/flame/runner.ex index 5dd2649..264dde8 100644 --- a/lib/flame/runner.ex +++ b/lib/flame/runner.ex @@ -363,6 +363,9 @@ defmodule FLAME.Runner do other when other in [{:ok, nil}, :error] -> {30_000, fn -> true end} end + timeout = opts[:timeout] || 30_000 + boot_timeout = opts[:boot_timeout] || 30_000 + runner = %Runner{ status: :awaiting_boot, @@ -370,8 +373,8 @@ defmodule FLAME.Runner do backend_init: :pending, log: Keyword.get(opts, :log, false), single_use: Keyword.get(opts, :single_use, false), - timeout: opts[:timeout] || 30_000, - boot_timeout: opts[:boot_timeout] || 30_000, + timeout: max(timeout, boot_timeout), + boot_timeout: boot_timeout, shutdown_timeout: opts[:shutdown_timeout] || 30_000, idle_shutdown_after: idle_shutdown_after_ms, idle_shutdown_check: idle_check, From 59fe023b8402aa4cbafc0d434e608c206ae5377e Mon Sep 17 00:00:00 2001 From: Coby Benveniste Date: Tue, 7 Jan 2025 21:00:13 +0200 Subject: [PATCH 2/5] Fix the File.stream! call variable order --- lib/flame/code_sync.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/flame/code_sync.ex b/lib/flame/code_sync.ex index 2743d5a..21a9299 100644 --- a/lib/flame/code_sync.ex +++ b/lib/flame/code_sync.ex @@ -193,7 +193,7 @@ defmodule FLAME.CodeSync do log_verbose("packaged size: #{File.stat!(out_path).size / (1024 * 1024)}mb") end - File.stream!(out_path, [], code.chunk_size) + File.stream!(out_path, code.chunk_size, []) end %PackagedStream{ From 2e9e89592f6aa9139023fe59852977fee89fa8da Mon Sep 17 00:00:00 2001 From: Coby Benveniste Date: Tue, 7 Jan 2025 21:01:36 +0200 Subject: [PATCH 3/5] Remove impossible match --- lib/flame/pool.ex | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/flame/pool.ex b/lib/flame/pool.ex index 9c0fbff..ee84876 100644 --- a/lib/flame/pool.ex +++ b/lib/flame/pool.ex @@ -306,9 +306,6 @@ defmodule FLAME.Pool do if Keyword.fetch!(place_opts, :link), do: Process.link(child_pid) {:cancel, {:replace, [child_pid]}, result} - :ignore -> - {:cancel, :ok, :ignore} - {:error, _reason} = result -> {:cancel, :ok, result} end From 3ec126091a942c5d48994bfa30432469a05763a3 Mon Sep 17 00:00:00 2001 From: Coby Benveniste Date: Mon, 27 Jan 2025 16:07:08 +0200 Subject: [PATCH 4/5] Revert "Set the timeout to max between itself and the boot_timeout" This reverts commit 7d5540de7159afee716a64a54519abae81b9b001. --- lib/flame/runner.ex | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/flame/runner.ex b/lib/flame/runner.ex index 264dde8..5dd2649 100644 --- a/lib/flame/runner.ex +++ b/lib/flame/runner.ex @@ -363,9 +363,6 @@ defmodule FLAME.Runner do other when other in [{:ok, nil}, :error] -> {30_000, fn -> true end} end - timeout = opts[:timeout] || 30_000 - boot_timeout = opts[:boot_timeout] || 30_000 - runner = %Runner{ status: :awaiting_boot, @@ -373,8 +370,8 @@ defmodule FLAME.Runner do backend_init: :pending, log: Keyword.get(opts, :log, false), single_use: Keyword.get(opts, :single_use, false), - timeout: max(timeout, boot_timeout), - boot_timeout: boot_timeout, + timeout: opts[:timeout] || 30_000, + boot_timeout: opts[:boot_timeout] || 30_000, shutdown_timeout: opts[:shutdown_timeout] || 30_000, idle_shutdown_after: idle_shutdown_after_ms, idle_shutdown_check: idle_check, From 08e9788a0595d9bb242f16a7ebe455168af46637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 27 Jan 2025 15:12:25 +0100 Subject: [PATCH 5/5] Update lib/flame/code_sync.ex --- lib/flame/code_sync.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/flame/code_sync.ex b/lib/flame/code_sync.ex index 21a9299..a360798 100644 --- a/lib/flame/code_sync.ex +++ b/lib/flame/code_sync.ex @@ -193,7 +193,8 @@ defmodule FLAME.CodeSync do log_verbose("packaged size: #{File.stat!(out_path).size / (1024 * 1024)}mb") end - File.stream!(out_path, code.chunk_size, []) + # TODO: Change to File.stream!(out_path, code.chunk_size) once we require Elixir v1.16+ + File.stream!(out_path, [], code.chunk_size) end %PackagedStream{