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

PriorityQueue's Length method returns wrong(?) number of elements #2

Closed
wngmnheiko opened this issue Jun 14, 2016 · 4 comments
Closed

Comments

@wngmnheiko
Copy link

When a PriorityQueue is already closed or dropped the Length method still returns the number of elements available before close/drop.

Maybe 0 or an error would be a better return value in this case.

@beeker1121
Copy link
Owner

beeker1121 commented Jun 14, 2016

Hmm, I'm open to hearing ideas on the best way to handle it, let's have that has the first option.

I'm thinking maybe there could be an error returned for each function if the stacks/queues are closed? Something like ErrDBClosed. This would return for all functions if the stack/queue is closed, i.e. Enqueue, Dequeue, Peek, Update, etc. Right now, for those functions, it returns the default LevelDB errors.

If this new error is added, should it be returned for the Length function as well?

@beeker1121
Copy link
Owner

Nevermind on adding the error to the Length function, that should only return uint64.

@beeker1121
Copy link
Owner

Ok I think I'll merge the two ideas, should have a new commit here within an hour or so. Thank you!

@beeker1121
Copy link
Owner

Fixed this with commit 39d78f4, thank you again!

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