[0.8.0] Merge `run` interfaces
What's Changed
Breaking changes
-
Option
:timeout
renamed to:checkout_timeout
.-
Reason: This option configures only the waiting time for
worker
from the pool, not the task's work time. This naming should be more understandable on the call site.# Before Poolex.run(:my_awesome_pool, fn worker -> some_work(worker) end, timeout: 10_000) # After Poolex.run(:my_awesome_pool, fn worker -> some_work(worker) end, checkout_timeout: 10_000)
-
-
Poolex.run/3
returns tuple{:error, :checkout_timeout}
instead of:all_workers_are_busy
.- Reason: It is easier to understand the uniform format of the response from the function:
{:ok, result}
or{:error, reason}
.
- Reason: It is easier to understand the uniform format of the response from the function:
-
Poolex.caller()
type replaced with struct defined inPoolex.Caller.t()
.- Reason: We need to save unique caller references.
-
Poolex.run!/3
was removed in favor ofPoolex.run/3
. The new unified function returns{:ok, result}
or{:error, :checkout_timeout}
and not handles runtime errors anymore.- Reason: We should not catch errors in the caller process. The caller process itself must choose how to handle exceptions and exit signals.
Fixed
- Fixed a bug when workers get stuck in
busy
status after checkout timeout.