diff --git a/README.md b/README.md index d14d9ae..facfb02 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/pyproject.toml b/pyproject.toml index eb6ab9b..4c7c851 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 = [ diff --git a/src/redis_store/redis_store.py b/src/redis_store/redis_store.py index 6f52ac8..c892bfc 100644 --- a/src/redis_store/redis_store.py +++ b/src/redis_store/redis_store.py @@ -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,