Skip to content

Commit c82a4a5

Browse files
committed
Release v0.10.1: Resolve string pool names in Pool handle_call
Update Snakepit.Pool.handle_call/3 to utilize resolve_pool_name_opt/2 when determining the target pool from call options. Previously, passing a pool name as a string would bypass internal atom mapping, leading to routing failures when callers provided string-based identifiers. Key changes: - Integrated resolve_pool_name_opt/2 into the execution flow. - Updated mix.exs and documentation to reflect the new version. - Added a unit test to verify that string-to-pool resolution functions as expected during command execution. - Updated CHANGELOG.md to document the bug fix.
1 parent 1e780df commit c82a4a5

File tree

6 files changed

+23
-4
lines changed

6 files changed

+23
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.10.1] - 2026-01-11
11+
12+
### Fixed
13+
- `Pool.handle_call/3` now resolves string `pool_name` options to configured pool atoms via `resolve_pool_name_opt/2`, fixing routing when callers pass pool names as strings.
14+
1015
## [0.10.0] - 2026-01-10
1116

1217
### Changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Add `snakepit` to your dependencies in `mix.exs`:
3131
```elixir
3232
def deps do
3333
[
34-
{:snakepit, "~> 0.10.0"}
34+
{:snakepit, "~> 0.10.1"}
3535
]
3636
end
3737
```

guides/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Add Snakepit as a dependency in your `mix.exs`:
6161
# mix.exs
6262
def deps do
6363
[
64-
{:snakepit, "~> 0.10.0"}
64+
{:snakepit, "~> 0.10.1"}
6565
]
6666
end
6767
```

lib/snakepit/pool/pool.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ defmodule Snakepit.Pool do
554554
@impl true
555555
def handle_call({:execute, command, args, opts}, from, state) do
556556
# Backward compatibility: route to default pool
557-
pool_name = opts[:pool_name] || state.default_pool
557+
pool_name = resolve_pool_name_opt(opts, state.default_pool)
558558
Dispatcher.execute(state, pool_name, command, args, opts, from, dispatcher_context())
559559
end
560560

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule Snakepit.MixProject do
22
use Mix.Project
33

4-
@version "0.10.0"
4+
@version "0.10.1"
55
@source_url "https://github.com/nshkrdotcom/snakepit"
66

77
def project do

test/unit/pool/pool_stream_checkout_test.exs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,18 @@ defmodule Snakepit.Pool.StreamCheckoutTest do
9494
assert new_state.pools.pool_b.worker_loads["worker_b"] == 1
9595
assert new_state.pools.pool_a.worker_loads == %{}
9696
end
97+
98+
test "execute resolves string pool_name to configured pool", %{state: state} do
99+
from = {self(), make_ref()}
100+
101+
pool_b = %{state.pools.pool_b | available: MapSet.new()}
102+
pools = Map.put(state.pools, :pool_b, pool_b)
103+
state = %{state | pools: pools}
104+
105+
{:noreply, new_state} =
106+
Pool.handle_call({:execute, "ping", %{}, [pool_name: "pool_b"]}, from, state)
107+
108+
assert :queue.len(new_state.pools.pool_b.request_queue) == 1
109+
assert :queue.len(new_state.pools.pool_a.request_queue) == 0
110+
end
97111
end

0 commit comments

Comments
 (0)