mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-18 09:06:06 +00:00
Fix a wave of bugs introduced by the user-priority branch's migration
from manual .decode('utf-8') calls to decode_responses=True on the
metadata Redis client:
core/utils.py
- Rewrite _init_client: fix SyntaxError at line 138, missing
redis_password/redis_user params, cls._client corruption when
decode_responses=False was requested, and dead retry backoff logic
apps/proxy/utils.py
- Fix get_user_limit_settings() → get_user_limits_settings() (2 sites)
- Fix VOD scan key vod_persistent_connections:* → vod_persistent_connection:*
- Fix undefined channel_id in VOD loop (use content_uuid from Redis hash)
- Remove leftover print(active_connections) debug statement
- Refactor manual cursor SCAN while-loops to scan_iter()
apps/channels/tasks.py
- Fix closure bug in _d(): md.get(key) → md.get(bkey) (was reading
the outer loop variable instead of the local bytes key)
apps/proxy/ts_proxy/server.py
- Replace stale b'init_time', b'total_bytes', b'state' byte-string
key lookups and .decode() calls with plain string equivalents
apps/proxy/ts_proxy/services/channel_service.py
- Fix ChannelMetadataField.STATE.encode() / .OWNER.encode() →
.STATE / .OWNER (pre-existing, broke under decoded client)
apps/proxy/ts_proxy/views.py
- Fix ChannelMetadataField.OWNER.encode("utf-8") → .OWNER
apps/proxy/ts_proxy/client_manager.py
- Fix cid.decode('utf-8') in remove_ghost_clients(): smembers()
already returns str with decode_responses=True
21 lines
673 B
Python
21 lines
673 B
Python
#!/usr/bin/env python
|
|
import os, sys
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dispatcharr.settings')
|
|
import django
|
|
django.setup()
|
|
|
|
from core.utils import RedisClient
|
|
|
|
r = RedisClient.get_client()
|
|
print(f"Client: {r}")
|
|
print(f"decode_responses: {r.connection_pool.connection_kwargs.get('decode_responses')}")
|
|
|
|
keys = list(r.scan_iter(match='ts_proxy:channel:*:metadata', count=100))
|
|
print(f"Found {len(keys)} metadata keys")
|
|
for k in keys[:3]:
|
|
print(f" Key: {k!r}")
|
|
data = r.hgetall(k)
|
|
field_names = list(data.keys())[:8]
|
|
print(f" Fields ({len(data)} total): {field_names}")
|
|
state = data.get('state', 'MISSING')
|
|
print(f" state={state!r}")
|