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

Comments

@bschmidtbauer
Copy link

commented Feb 2, 2017

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

This comment has been minimized.

Copy link
Collaborator

commented Feb 14, 2017

fixed in #43

@mhowlett mhowlett closed this Feb 14, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.