fix: reject timeout= in pool_kwargs with a clear ValueError (redis-2)
a caller passing the driver-native timeout= (instead of pool_timeout=) would hit a cryptic 'multiple values for timeout' from BlockingConnectionPool. now raise a clear ValueError pointing at pool_timeout. verified vs real redis. README note added. bump v0.1.1 -> v0.1.2 Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
@@ -14,19 +14,19 @@ datastore trio (`redis` / `psql` / `mysql`), a sibling of the `mongo` lib.
|
||||
`requirements.txt`:
|
||||
|
||||
```
|
||||
redis_store @ git+ssh://git@git.rethinkstudios.io/rethink-public/redis.git@v0.1.1
|
||||
redis_store @ git+ssh://git@git.rethinkstudios.io/rethink-public/redis.git@v0.1.2
|
||||
```
|
||||
|
||||
Direct:
|
||||
|
||||
```bash
|
||||
pip install "redis_store @ git+ssh://git@git.rethinkstudios.io/rethink-public/redis.git@v0.1.1"
|
||||
pip install "redis_store @ git+ssh://git@git.rethinkstudios.io/rethink-public/redis.git@v0.1.2"
|
||||
```
|
||||
|
||||
Pulls `redis>=5` (redis-py, which ships the asyncio client — **not** the dead standalone
|
||||
`aioredis`).
|
||||
|
||||
Drop the `@v0.1.1` suffix from the line above to install the latest unpinned.
|
||||
Drop the `@v0.1.2` suffix from the line above to install the latest unpinned.
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -62,6 +62,10 @@ One client/pool per process — build it once, attach it to your app (`app.kv =
|
||||
`None` for an absent key). Pass `decode_responses=False` at construction for raw `bytes`.
|
||||
Counters and counts (`incr`/`decr`/`exists`/`ttl`) always return `int` regardless.
|
||||
|
||||
Pool sizing/timeout are `max_connections=` and `pool_timeout=` (how long a caller waits for
|
||||
a free connection when the pool is saturated). Pass the driver's own `timeout=` in
|
||||
`pool_kwargs` and construction raises a clear `ValueError` — use `pool_timeout=`.
|
||||
|
||||
## Error contract — fail loud
|
||||
|
||||
Unlike the `mongo` lib (which log-and-swallows, returning a safe default), **this lib
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "redis_store"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
description = "async redis wrapper over redis-py asyncio with a raw escape hatch, fail-loud and config-free"
|
||||
requires-python = ">=3.10"
|
||||
dependencies = [
|
||||
|
||||
@@ -71,7 +71,16 @@ class RedisDB:
|
||||
max_connections, callers WAIT up to pool_timeout seconds for a free connection
|
||||
(matching motor/mongo's blocking pool) rather than the plain pool's behavior of
|
||||
raising MaxConnectionsError immediately. pool_timeout=None waits forever.
|
||||
|
||||
`timeout` is the pool's own kwarg (set from pool_timeout here), so passing it in
|
||||
pool_kwargs would collide — reject it with a clear pointer rather than let the
|
||||
driver raise a cryptic "multiple values for 'timeout'".
|
||||
"""
|
||||
if "timeout" in pool_kwargs:
|
||||
raise ValueError(
|
||||
"redis_store: pass the pool wait timeout as pool_timeout=, not timeout= "
|
||||
"(timeout is filled from pool_timeout)"
|
||||
)
|
||||
self._pool = redis.BlockingConnectionPool(
|
||||
host=host,
|
||||
port=port,
|
||||
|
||||
Reference in New Issue
Block a user