Closed djnym closed 10 years ago
Hi Anthony.
I guess I'm surprised that people are actually using gproc_pool :) But if it has the potential of being useful, let's ensure that the API is convenient.
ok
is the better return value, so I'll fix the documentationgproc_pool:pick/1
. I can definitely add a pick_worker/1
function.Comments?
The change looks good to me. I like that pick_worker just returns the pid that helps since I can just pick and send.
Ok, good. I merged the PR. Thanks.
When trying to use gproc_pool, I'm finding myself having to jump through some hoops and am not sure if I'm doing something wrong or not, so opening an issue so if there is one it can be tracked.
First off, the documentation for gproc_pool:new/1,3 say they return 'true', but they actually return 'ok'.
Next the pick/1,2 functions seem to return an internal representation. For an example,
This means I can't do the natural sort of thing like
but instead need to do something convoluted like
which while not bad, seems like a poor API, but I might be missing something completely, so please correct me if there is a better way to do this? Oh, actually, I might have just found it, looks like you can do
is that the expected way to use gproc_pool, or would it be better to have pick/1,3 (or maybe a wrapper pick_worker/1,3) which does the unboxing and returns a worker id. It would make the gproc_pool API a bit cleaner if you didn't actually have to call gproc functions in general use.