🚀 New issue to ag2ai/faststream by @GrigoriyKuzevanov
📝 Bug: min_idle_time ignored when group and consumer are specified (#2678)
Describe the bug
When a StreamSub has both 'group' and 'consumer', and 'min_idle_time' specified, Faststream uses 'XREADGROUP' instead of 'XAUTOCALIM'
How to reproduce
Include source code:
Redis MONITOR output shows:
Expected behavior
Observed behavior
I suppose that a root cause in
Or i just misunderstand the logic.
Environment
Running FastStream 0.6.3 with CPython 3.12.3 on Linux
#bug #good_first_issue #faststream #ag2ai
sent via relator
📝 Bug: min_idle_time ignored when group and consumer are specified (#2678)
Describe the bug
When a StreamSub has both 'group' and 'consumer', and 'min_idle_time' specified, Faststream uses 'XREADGROUP' instead of 'XAUTOCALIM'
How to reproduce
Include source code:
from faststream import FastStream
from faststream.redis import RedisBroker, StreamSub
broker = RedisBroker("redis://localhost:6379")
@broker.subscriber(
stream=StreamSub(
"orders",
group="processors",
consumer="claimer",
min_idle_time=10000, # Should trigger XAUTOCLAIM
)
)
async def claiming_handler(msg):
print("Should use XAUTOCLAIM, but uses XREADGROUP")
app = FastStream(broker)
Redis MONITOR output shows:
XREADGROUP GROUP processors claimer BLOCK 100 STREAMS orders >
Expected behavior
XAUTOCLAIM orders processors claimer 10000 0-0 COUNT 1
Observed behavior
I suppose that a root cause in
faststream/redis/subscriber/use_cases/stream_subscriber, method _StreamHandlerMixin.start():if stream.group and stream.consumer: # ← Checked FIRST
# Uses XREADGROUP
...
elif self.stream_sub.min_idle_time is None:
# Uses XREAD
...
else:
# Uses XAUTOCLAIM ← Never reached when group is set!
...
Or i just misunderstand the logic.
Environment
Running FastStream 0.6.3 with CPython 3.12.3 on Linux
#bug #good_first_issue #faststream #ag2ai
sent via relator