File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -423,7 +423,8 @@ defmodule FLAME.Pool do
423423 runner_count = runner_count ( state )
424424
425425 cond do
426- runner_count == 0 || ( min_runner . count == state . max_concurrency && runner_count < state . max ) ->
426+ runner_count == 0 || ! min_runner ||
427+ ( min_runner . count == state . max_concurrency && runner_count < state . max ) ->
427428 if map_size ( state . pending_runners ) > 0 || state . async_boot_timer do
428429 waiting_in ( state , deadline , from )
429430 else
Original file line number Diff line number Diff line change @@ -58,6 +58,30 @@ defmodule FLAME.FLAMETest do
5858 assert new_pool == Supervisor . which_children ( runner_sup )
5959 end
6060
61+ @ tag runner: [ min: 0 , max: 1 , max_concurrency: 2 ]
62+ test "concurrent calls on fully pending runners" ,
63+ % { runner_sup: runner_sup } = config do
64+ assert Supervisor . which_children ( runner_sup ) == [ ]
65+ parent = self ( )
66+
67+ Task . start_link ( fn ->
68+ FLAME . call ( config . test , fn ->
69+ send ( parent , :called )
70+ Process . sleep ( :infinity )
71+ end )
72+ end )
73+
74+ Task . start_link ( fn ->
75+ FLAME . call ( config . test , fn ->
76+ send ( parent , :called )
77+ Process . sleep ( :infinity )
78+ end )
79+ end )
80+
81+ assert_receive :called
82+ assert_receive :called
83+ end
84+
6185 def on_grow_start ( meta ) do
6286 send ( :failure_test , { :grow_start , meta } )
6387
You can’t perform that action at this time.
0 commit comments