available_worker doesn't handle worker exit
ElectronicRU opened this issue · 2 comments
With strategy available_worker, at some point, call is transformed into a cast, which means there's no monitor on the worker process, and if it dies as the result, the call times out instead of failing otherwise.
That is true, but we never found a good way around it. Do you have any suggestion on how to implement a call that's only dispatched to a worker (through wpool_queue_manager
) when there is an available worker but still act as a gen_server:call
from the outside without blocking the queue manager?
PRs are very much welcomed here :)
We could, before doing the cast_call, setup a monitor and then handle it in handle_info(). We can demonitor on worker_ready, too.
Edit: we would need to send a special message to the queue manager's caller and handle it there to raise a proper exception, of course, but such is the life.