Browse Source

Do not adjust pool size down if `auto_size == false`. Fixes #167

When removing a worker from a pool, the size of the pool could be
adjusted down even if auto_size was disabled. This could have the
effect that the pool couldn't be refilled with new workers.
Ulf Wiger 6 years ago
parent
commit
8bb81de839
1 changed files with 7 additions and 2 deletions
  1. 7 2
      src/gproc_pool.erl

+ 7 - 2
src/gproc_pool.erl

@@ -833,8 +833,13 @@ do_remove_worker_(Pool, Name) ->
     case (NewLen = length(Ws1)) - length(Ws0) of
         0 -> ok;
         Diff when Diff < 0 ->
-            {_, Type} = gproc:get_value(K, shared),
-            gproc:set_value_shared(K, {NewLen, Type})
+            case gproc:get_attribute(K, shared, auto_size) of
+                true ->
+                    {_, Type} = gproc:get_value(K, shared),
+                    gproc:set_value_shared(K, {NewLen, Type});
+                false ->
+                    ok
+            end
     end,
     gproc:set_attributes_shared(K, [{workers, Ws1}]),
     ok.