-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Refactored PublisherConfirms.cs #549
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
Refactored PublisherConfirms.cs #549
Conversation
* Deduped PublishMessagesInBatchAsync() method's batch publishing code * Deleted outstandingMessageCount variable; use publishTasks.Count instead * Fixed potential bug by setting minimum batch size to 1
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.
The example originally contained duplicated code, to handle the case where publishTasks contained one or more items after the foreach(...) loop was exited, but it contained fewer items that the specified batch size (batchSize). The updated check should cover both cases & eliminate the need for the duplicated code.
There's also no need to check if publishTasks.Count > 0, because that statement will always be true.
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.
Thanks, this is a bit more complex that I'd like so I'll push a change to your PR.
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.
@lukebakken any objections to merging these?
Refactored
PublisherConfirms.cs:PublishMessagesInBatchAsync()method's batch publishing codeoutstandingMessageCountvariable; usepublishTasks.Countinstead