Skip to content

fix: TestRedisBroker delivers freshly-published messages to subscribers with min_idle_time#2878

Open
ApusBerliozi wants to merge 3 commits into
ag2ai:mainfrom
ApusBerliozi:2848_fix_TestRedisBroker_message_delivery
Open

fix: TestRedisBroker delivers freshly-published messages to subscribers with min_idle_time#2878
ApusBerliozi wants to merge 3 commits into
ag2ai:mainfrom
ApusBerliozi:2848_fix_TestRedisBroker_message_delivery

Conversation

@ApusBerliozi

@ApusBerliozi ApusBerliozi commented May 19, 2026

Copy link
Copy Markdown
Contributor

Description

So, in order to "emulate" xautoclaim, I decided to add asyncio.wait_for in FakeProducer.publish, with timeout of 30 seconds (cause it's the maximum for pytest). I think it's a reasonable compromise, cause it will simulate how production environment would handle this situation. So, if min_idle_time is less than 30 seconds we will proceed with the call after some delay and if it isn't - we won't.

Fixes #2848

Type of change

  • Bug fix (a non-breaking change that resolves an issue)

Checklist

  • My code adheres to the style guidelines of this project (just lint shows no errors)
  • I have conducted a self-review of my own code
  • I have made the necessary changes to the documentation
  • My changes do not generate any new warnings
  • I have added tests to validate the effectiveness of my fix or the functionality of my new feature
  • Both new and existing unit tests pass successfully on my local environment by running just test-coverage
  • I have ensured that static analysis tests are passing by running just static-analysis
  • I have included code examples to illustrate the modifications

@ApusBerliozi
ApusBerliozi requested a review from Lancetnik as a code owner May 19, 2026 09:00
@github-actions github-actions Bot added the Redis Issues related to `faststream.redis` module and Redis features label May 19, 2026
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 19, 2026
@ApusBerliozi

Copy link
Copy Markdown
Contributor Author

Hello @Lancetnik!

Can you please take a look at this PR?

@Lancetnik

Copy link
Copy Markdown
Member

@ApusBerliozi sorry, I undestand nothing in Redis Streams
We need @powersemmi help to review any Redis PRs

@Lancetnik
Lancetnik requested review from powersemmi and removed request for Lancetnik July 4, 2026 11:35
@ApusBerliozi

Copy link
Copy Markdown
Contributor Author

Oh I see, no worries @Lancetnik, thx 4 the info

@powersemmi

Copy link
Copy Markdown
Collaborator

@ApusBerliozi

I've created an issue that should solve this problem at the root: waiting in tests isn't great, it would be simpler to emulate the PEL instead. That way it also becomes possible to test autoclaim separately from the regular handler.

See #2927

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation Redis Issues related to `faststream.redis` module and Redis features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: TestRedisBroker delivers freshly-published messages to subscribers with min_idle_time

3 participants