Skip to content

Commit

Permalink
Fix documentation types
Browse files Browse the repository at this point in the history
  • Loading branch information
NelsonVides committed Sep 21, 2024
1 parent 829403d commit fb4f37a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
18 changes: 11 additions & 7 deletions src/wpool.erl
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
%%
%% Defaults to `5'. See {@link wpool_pool} for more details.

-type queue_type() :: wpool_queue_manager:queue_type().
-type queue_type() :: fifo | lifo.
%% Order in which requests will be stored and handled by workers.
%%
%% This option can take values `lifo' or `fifo'. Defaults to `fifo'.
Expand Down Expand Up @@ -273,7 +273,8 @@
{workers, [{pos_integer(), worker_stats()}]}].
%% Statistics about a given live pool.

-export_type([name/0, option/0, options/0, custom_strategy/0, strategy/0, worker_stats/0, stats/0]).
-export_type([name/0, option/0, options/0, custom_strategy/0, strategy/0,
queue_type/0, worker_stats/0, stats/0]).

-export([start/0, start/2, stop/0, stop/1]).
-export([child_spec/2, start_pool/1, start_pool/2, start_sup_pool/1, start_sup_pool/2]).
Expand Down Expand Up @@ -380,10 +381,11 @@ call(Sup, Call, Strategy) ->
call(Sup, Call, Strategy, 5000).

%% @doc Picks a server and issues the call to it.
%% For all strategies except available_worker, Timeout applies only to the
%% time spent on the actual call to the worker, because time spent finding
%% the worker in other strategies is negligible.
%% For available_worker the time used choosing a worker is also considered
%%
%% For all strategies except available_worker, Timeout applies only to the
%% time spent on the actual call to the worker, because time spent finding
%% the worker in other strategies is negligible.
%% For available_worker the time used choosing a worker is also considered
-spec call(name(), term(), strategy(), timeout()) -> term().
call(Sup, Call, available_worker, Timeout) ->
wpool_pool:call_available_worker(Sup, Call, Timeout);
Expand Down Expand Up @@ -434,7 +436,8 @@ send_request(Sup, Call, Strategy) ->
send_request(Sup, Call, Strategy, 5000).

%% @doc Picks a server and issues the call to it.
%% Timeout applies only for the time used choosing a worker in the available_worker strategy
%%
%% Timeout applies only for the time used choosing a worker in the available_worker strategy
-spec send_request(name(), term(), strategy(), timeout()) ->
noproc | timeout | gen_server:request_id().
send_request(Sup, Call, available_worker, Timeout) ->
Expand Down Expand Up @@ -486,6 +489,7 @@ stats(Sup) ->
wpool_pool:stats(Sup).

%% @doc Retrieves the list of worker registered names.
%%
%% This can be useful to manually inspect the workers or do custom work on them.
-spec get_workers(name()) -> [atom()].
get_workers(Sup) ->
Expand Down
5 changes: 2 additions & 3 deletions src/wpool_queue_manager.erl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
clients :: queue:queue({cast | {pid(), _}, term()}),
workers :: gb_sets:set(atom()),
monitors :: #{atom() := monitored_from()},
queue_type :: queue_type()}).
queue_type :: wpool:queue_type()}).

-opaque state() :: #state{}.

Expand All @@ -50,15 +50,14 @@

-type arg() :: option() | pool.
-type queue_mgr() :: atom().
-type queue_type() :: fifo | lifo.
-type worker_event() :: new_worker | worker_dead | worker_busy | worker_ready.

-export_type([worker_event/0]).

-type call_request() :: {available_worker, infinity | pos_integer()} | pending_task_count.

-export_type([call_request/0]).
-export_type([queue_mgr/0, queue_type/0]).
-export_type([queue_mgr/0]).

%%%===================================================================
%%% API
Expand Down

0 comments on commit fb4f37a

Please sign in to comment.