feat(emqx_utils): allow `infinity` timeout in `pmap/3`

This commit is contained in:
Serge Tupchii 2024-01-18 19:03:54 +02:00
parent a40a13b786
commit 54457b7093
1 changed files with 3 additions and 1 deletions

View File

@ -431,7 +431,9 @@ pmap(Fun, List) when is_function(Fun, 1), is_list(List) ->
-spec pmap(fun((A) -> B), list(A), timeout()) -> list(B). -spec pmap(fun((A) -> B), list(A), timeout()) -> list(B).
pmap(Fun, List, Timeout) when pmap(Fun, List, Timeout) when
is_function(Fun, 1), is_list(List), is_integer(Timeout), Timeout >= 0 is_function(Fun, 1),
is_list(List),
(is_integer(Timeout) andalso Timeout >= 0 orelse Timeout =:= infinity)
-> ->
nolink_apply(fun() -> do_parallel_map(Fun, List) end, Timeout). nolink_apply(fun() -> do_parallel_map(Fun, List) end, Timeout).