fix(redis): 修复 Redis 流读取兼容性问题
- 支持 bytes 和 str 类型的 entry_id - 支持 list 类型响应格式 - 优化 payload 解码处理
This commit is contained in:
@@ -29,6 +29,14 @@ DEDUP_LOCK_SECONDS = 300
|
||||
DEDUP_INFLIGHT_MARKER = "__inflight__"
|
||||
|
||||
|
||||
def _event_stream_block_ms() -> int:
|
||||
configured = int(config.agent_runtime.redis_stream_block_ms)
|
||||
socket_timeout = float(config.redis.socket_timeout)
|
||||
socket_timeout_ms = max(int(socket_timeout * 1000), 1)
|
||||
safe_max = max(socket_timeout_ms - 100, 1)
|
||||
return max(1, min(configured, safe_max))
|
||||
|
||||
|
||||
class TaskiqQueueClient:
|
||||
def __init__(self) -> None:
|
||||
self._redis: Redis | None = None
|
||||
@@ -93,7 +101,7 @@ class RedisEventStream:
|
||||
client=client,
|
||||
stream_prefix=config.agent_runtime.redis_stream_prefix,
|
||||
read_count=config.agent_runtime.redis_stream_read_count,
|
||||
block_ms=config.agent_runtime.redis_stream_block_ms,
|
||||
block_ms=_event_stream_block_ms(),
|
||||
)
|
||||
return self._bus
|
||||
|
||||
|
||||
Reference in New Issue
Block a user