Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismccord committed Aug 27, 2024
1 parent 0877721 commit b87ad08
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/flame/fly_backend.ex
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ defmodule FLAME.FlyBackend do

%FlyBackend{} = state = Map.merge(default, Map.new(provided_opts))

IO.inspect({opts, state.boot_timeout})

for key <- [:token, :image, :host, :app] do
unless Map.get(state, key) do
raise ArgumentError, "missing :#{key} config for #{inspect(__MODULE__)}"
Expand Down
2 changes: 1 addition & 1 deletion lib/flame/pool.ex
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ defmodule FLAME.Pool do
cond do
runner_count == 0 || !min_runner ||
(min_runner.count == state.max_concurrency && runner_count < state.max) ->
if map_size(state.pending_runners) > 0 || state.async_boot_timer do
if state.async_boot_timer || map_size(state.pending_runners) * state.max_concurrency > Queue.size(state.waiting) do
waiting_in(state, deadline, from)
else
state
Expand Down
2 changes: 1 addition & 1 deletion test/fly_backend_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ defmodule FLAME.FlyBackendTest do
end

assert_raise ArgumentError, ~r/missing :app/, fn ->
new({FlyBackend, token: "123", image: "img"})
new({FlyBackend, token: "123", image: "img", boot_timeout: 55123})
end

assert new({FlyBackend, token: "123", image: "img", app: "app"})
Expand Down

0 comments on commit b87ad08

Please sign in to comment.