devinus / poolboy

A hunky Erlang worker pool factory
http://github.com/devinus/poolboy
ISC License
1.54k stars 345 forks source link

Allow worker arguments of any type #95

Open manifest opened 7 years ago

manifest commented 7 years ago

There is no sense to restrict worker arguments to proplists. While they are opaque to poolboy and are passed as is, they could be anything.

manifest commented 7 years ago

For instance, it's handy to use map type for worker's configuration. But by doing it you will receive dialyzer error:

make dialyze
  Checking whether the PLT /Users/aenesterov/projects/github/riak-connection-pool/.riakc_pool.plt is up-to-date... yes
  Proceeding with analysis...
riakc_pool_conn.erl:37: The specified type for the 1st argument of start_link/1 (map()) is not a supertype of [atom() | tuple()], which is expected type for this argument in the callback of the poolboy_worker behaviour
riakc_pool_conn.erl:38: The inferred type for the 1st argument of start_link/1 (#{'host':=maybe_improper_list(), 'port':=pos_integer(), _=>_}) is not a supertype of [atom() | tuple()], which is expected type for this argument in the callback of the poolboy_worker behaviour
Unknown types:
  ssl:sslsocket/0
 done in 0m1.25s
done (warnings were emitted)
make: *** [dialyze] Error 2
manifest commented 7 years ago

@devinus what do you think on that matter?