Skip to content

fix(nats): batch consuming - #3238

Merged
IvanKirpichnikov merged 3 commits into
mainfrom
fix/nats-batching
Sep 26, 2026
Merged

IvanKirpichnikov merged 3 commits into
mainfrom
fix/nats-batching

Conversation

@draincoder

@draincoder draincoder commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Description

nats-py starts fetch(batch>1) with a no_wait request, so it may return available messages before the batch is full or the timeout expires. FastStream previously passed that partial result straight to the handler. Since fetch() does not expose no_wait, FastStream now fetches the remaining messages within one overall timeout and calls the handler when the batch is full or the timeout expires.

Fixes #2219

Type of change

Please delete options that are not relevant.

  • 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

@CLAassistant

CLAassistant commented Sep 25, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot added documentation Improvements or additions to documentation NATS Issues related to `faststream.nats` module and NATS broker features labels Sep 25, 2026
@draincoder
draincoder marked this pull request as ready for review September 26, 2026 11:43
@IvanKirpichnikov
IvanKirpichnikov added this pull request to the merge queue Sep 26, 2026
Merged via the queue into main with commit 3509bd2 Sep 26, 2026
32 checks passed
@IvanKirpichnikov
IvanKirpichnikov deleted the fix/nats-batching branch September 26, 2026 12:58
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 NATS Issues related to `faststream.nats` module and NATS broker features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: NATS PullSub batch=True does not work reliably

3 participants