-
Notifications
You must be signed in to change notification settings - Fork 89
Fix pending message reset logic in NatsJSConsume #930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request improves the pending message reset logic in the NatsJSConsume class by replacing duplicate manual counter reset code with a dedicated method call. The change addresses issue #927 related to proper handling of pending message counters during reconnection scenarios.
- Replaces manual pending counter resets with calls to existing
ResetPending()method - Adds test coverage for ephemeral consumer reconnection behavior to prevent flooding the server with pull requests
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/NATS.Client.JetStream/Internal/NatsJSConsume.cs | Refactors duplicate pending counter reset logic to use ResetPending() method |
| tests/NATS.Client.JetStream.Tests/ConsumerConsumeTest.cs | Adds test to verify proper pending reset behavior during server reconnection |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
scottf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Fix pending message reset logic in NatsJSConsume * Add consumer test for pending reset on 503
* Fix pending message reset logic in NatsJSConsume (nats-io#930) * Fix CommandWriter.cs dispose (nats-io#926)
This pull request refactors how pending message and byte counters are reset in the
ReceiveInternalAsyncmethod ofNatsJSConsume. Instead of manually resetting these counters within a lock block, the code now calls a dedicated method,ResetPending, which improves code readability and maintainability and does the right thing instead of setting them to zero.