Skip to content
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

SafeKafkaHandle.ListGroup throws exception #34

Closed
bschmidtbauer opened this issue Feb 2, 2017 · 1 comment
Closed

SafeKafkaHandle.ListGroup throws exception #34

bschmidtbauer opened this issue Feb 2, 2017 · 1 comment

Comments

@bschmidtbauer
Copy link

The below method in SafeKafkaHandle will throw an exception when a non-existent group name is passed:

internal GroupInfo ListGroup(string group, int millisecondsTimeout)
   =>  ListGroupsImpl(group, millisecondsTimeout).Single();

The exception is due to the implementation of Single() in .NET, where the sequence you invoke it on needs to contain 1 and only 1 item that matches the predicate (in this case no predicate). A different option is SingleOrDefault(), even better is probably FirstOrDefault() as using 'firs't is typically going to perform better as the 'single' methods need to scan the entire collection to make sure there are no duplicates. In this case there should never be more than one so it shouldn't matter.

@mhowlett
Copy link
Contributor

fixed in #43

airlock-confluentinc bot pushed a commit that referenced this issue Sep 10, 2024
KIP 848 ListGroups API for the support of New Consumer Group Type 'Consumer'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants