fix: bump redis floor to 5.0.1, disconnect pool on failed connect(), doc/type nits (redis-5/6/7/8); v0.1.4
redis-5: redis>=5 admitted 5.0.0, which lacks async aclose() and crashes on teardown; floor bumped to >=5.0.1 (confirmed 5.0.1 is where aclose() lands). redis-6: connect()/__aenter__ now disconnects the pool before re-raising on a failed ping, so a discarded RedisDB from a failed `async with` doesn't hold a live pool. redis-7: docstring/README conflated repo name (redis) with distribution name (redis_store). redis-8: pool_timeout hinted Optional[float] to match that None is accepted (wait forever). Also compresses the module and __init__ docstrings (no behavior change), keeping the SSLConnection-mapping and pool-disconnect-on-failure notes. Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
@@ -4,7 +4,7 @@ Async Redis wrapper over redis-py's asyncio client — a small, config-free, **f
|
||||
key/value + hash + ttl surface with a raw escape hatch for everything else. First of the
|
||||
datastore trio (`redis` / `psql` / `mysql`), a sibling of the `mongo` lib.
|
||||
|
||||
> **Import name ≠ repo name.** The repo/distribution is **`redis`**, but you import
|
||||
> **Import name ≠ repo name.** The repo is **`redis`**, the distribution is
|
||||
> **`redis_store`** — the driver package owns the `redis` import namespace, so the lib
|
||||
> can't also be `redis`. Install resolves `redis.git`; code does
|
||||
> `from redis_store import RedisDB`.
|
||||
@@ -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.3
|
||||
redis_store @ git+ssh://git@git.rethinkstudios.io/rethink-public/redis.git@v0.1.4
|
||||
```
|
||||
|
||||
Direct:
|
||||
|
||||
```bash
|
||||
pip install "redis_store @ git+ssh://git@git.rethinkstudios.io/rethink-public/redis.git@v0.1.3"
|
||||
pip install "redis_store @ git+ssh://git@git.rethinkstudios.io/rethink-public/redis.git@v0.1.4"
|
||||
```
|
||||
|
||||
Pulls `redis>=5` (redis-py, which ships the asyncio client — **not** the dead standalone
|
||||
`aioredis`).
|
||||
Pulls `redis>=5.0.1` (redis-py, which ships the asyncio client — **not** the dead standalone
|
||||
`aioredis`; `5.0.1` is the floor because `5.0.0` lacks the async client's `aclose()`).
|
||||
|
||||
Drop the `@v0.1.3` suffix from the line above to install the latest unpinned.
|
||||
Drop the `@v0.1.4` suffix from the line above to install the latest unpinned.
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -55,6 +55,8 @@ async with RedisDB(host="localhost") as kv:
|
||||
```
|
||||
|
||||
One client/pool per process — build it once, attach it to your app (`app.kv = ...`), share it.
|
||||
A failed `connect()`/`__aenter__` ping disconnects the pool before re-raising, so a
|
||||
discarded `RedisDB` from a failed `async with` doesn't hold a live pool.
|
||||
|
||||
## Type contract
|
||||
|
||||
@@ -63,8 +65,9 @@ One client/pool per process — build it once, attach it to your app (`app.kv =
|
||||
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=`.
|
||||
a free connection when the pool is saturated; `Optional[float]`, `None` waits forever).
|
||||
Pass the driver's own `timeout=` in `pool_kwargs` and construction raises a clear
|
||||
`ValueError` — use `pool_timeout=`.
|
||||
|
||||
`ssl=True` maps to `connection_class=redis.asyncio.SSLConnection`, so TLS works via the
|
||||
documented `pool_kwargs` path (the default connection class has no `ssl` parameter and
|
||||
|
||||
Reference in New Issue
Block a user